Reputation: 12637
I can't find a working example on this. Every example I read doesn't mention storyboard, including release notes.
I don't want to add a subview programmatically, since I'm using a storyboard. Here is my view on the storyboard.
And here is the structure:
I was trying to follow release notes mixed approach and made contentView that has fixed width and height constraints, also leading and top constraints set to superview (scrollview in this case). Elements inside View have constraints reffering to View, and not the scrollview.
I also adde this code on viewcontroller viewDidLoad
scrollView.translatesAutoresizingMaskIntoConstraints = NO;
CGRect contentFrame = CGRectMake(0, 0, 320, 800);
[scrollView setContentSize:contentFrame.size];
All I get is not scrollable UIScrollView.
I'm struggling with this for weeks, is there a really working example out there?
EDIT: Uploaded sample project that demonstrates the issue. It also solves it! :)
Upvotes: 0
Views: 123
Reputation: 12637
The problem was ambigous content size width and height inside scroll view. The key is to not only pint trailing, leading, top and bottom constraints to scrollview but also make static scrollview height and width constraint.
Here is sample project with solution
Upvotes: 0