All Projects → skywinder → Scrollviewambigous

skywinder / Scrollviewambigous

Example for my question on SO

Programming Languages

swift
15916 projects

ScrollViewAmbigous Example

Example for my question on SO: UIScrollView + Centered View + Ambigous Scrollable Content Size + many iPhone sizes

The initial state, with existing problems: 0a8bf35

And resolved Has ambiguous scrollable content width and Has ambiguous scrollable content height annoying warnings : 3b3e874

So, here is the initial state for simplest case:

  1. scrollView with 0 constraints to all edges
  2. Button centered Horizontal and Vertical with fixed Width and Height
  3. And, of course Has ambiguous scrollable content width and Has ambiguous scrollable content height annoying warnings.

1

All, that we have to do is:

  • Add 2 additional constraints, for example "0" for trailing and/or bottom space for our view (in my case - UIButton)

Important: you have to add trailing and/or bottom constraints. Not "leading and top" - it's not works!

2

You can check it in my example project, that demonstrating how to fix this issue: ScrollViewAmbigous

P.S.

I don't know why it works and how Xcode detect which constraint is more prioritised (because I'm not set priority for these constraints explicity), but I'll be thankful if someone explain, why it works.

Aligning multiple elements?

When you want to align multiple elements, say three button in one vertical line, you'll have to set the above said additional constraints to the bottom most element. (example included)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].