I have a UIView
inside a UIScrollView
. I can easily pin the height to the UIScrollView
's frame height.
How do I add a constraint that pins to the UIScrollView's contentSize
instead?
Thanks!
I have a UIView
inside a UIScrollView
. I can easily pin the height to the UIScrollView
's frame height.
How do I add a constraint that pins to the UIScrollView's contentSize
instead?
Thanks!
UIScrollView have dynamic constraints, left, top, width and height are generated at runtime. If you put a UIView inside a UIScrollview and Pin fixed constraints in Interface Builder it will generate an error because the parameters are relative to Superview/Container View.
You can try some workarounds:
1- Add UIView constraints Programmatically
http://www.thinkandbuild.it/learn-to-love-auto-layout-programmatically/
2- Manually resize your view bounds in initWithFrame function inside a UIView Subclass
Please give me any feedback about your progress.
The answer "Adding constraints programatically" is correct but it was a little light on detail for me to accept it as the full answer.
Here's how I did it!
--Code--