Making UIContainerView as wide as device screen

75 views Asked by At

I can't seem to correctly reason about this problem so I was hoping someone could give me some tips to guide me along.

So I have 4 UIContainerView's WITHIN a UIScrollView. As the User swipes, the Containers display 4 individual UIViewControllers.

What I want is, through autolayout, to specify that each UIContainerView must take up the device screen's width. So as a user scrolls, one UIViewController is shown at a time on the entire screen

The problems I am running into: 1. Can't make a IBOutlet from UIContainerView .. not sure why 2. No way in autolayout to specify "device screen width" within a UIScrollView

Any help would be appreciated!

1

There are 1 answers

0
rounak On BEST ANSWER

Your UIScrollView must be contained inside a UIViewController nib. Make constraints from your container view for equal widths to your view controller's view in Interface builder, and then place all container views next to each other using AL.