0
votes

I'm trying to build a scrollview form in my app. So, there is the EditForm (which is a uiviewcontroller) which contains a scrollview which contains a contentView (uiview), which contains my fields.

How do I initialize all these views with autolayout ? To say to the scrollview to take the entire size of the contentView (i'm adding subview on contentView), to the scrollView to be on the uiviewcontroller, and of course, for the scrollView to scroll properly depending of the size of contentView.

Thanks :)

1

1 Answers

0
votes

Actually, this is very easy to do so.

I personally like use pure code without any IB in my applications. First check this link from Apple.

Basic step is:

  1. Make sure all your subviews are translatesAutoresizingMaskIntoConstraints = NO;
  2. Add constraints for your views using VFL

Tips for UIScrollView for AutoLayout - You need to add bottom constraints for your bottom subviews so that scroll view can be scrollable.

Good Luck : )