I have a UIScrollView
with couple UILabel
s where I don't know the content of before execution. All the contents are embedded in a UIView
(for the scrolling to work).
I also have a UIImageView
that sits on top. So the layout if roughly like this
-------------------
| |
| UIImageView |
| |
| UILabel |
| |
| UILabel |
| |
| UILabel |
| |
| UILabel |
| |
-------------------
All UIView
s are horizontally centered and have a leading and trailing space of 20. Each UILabel
has a top and bottom space of 20.
And now comes the current problem. I want to have a varying top space for the UIImageView
depending on what the screen size. If I have a fixed top space of lets say 20, then everything works. But if I try to set a range, lets say lessOrEqualTo
50 and greaterOrEqualTo
10, then I get a constraint error saying that the scroll view needs constraints for y position or height.
So how can I set the range of the top space without getting constraint error?