Doesn’t work UIScrollView?
How to use UIScrollView in Storyboard with AutoLayout.
Storyboard
1.Change “Size” Property of ViewController to “Freeform”.
2.Set ViewController’s width(or height) to Contents Size(eg:640)
3.ViewController’s parts are given bellow. Two UITableViews in ScrollView。
Looks double width.
4.Relation to ViewController(your filename)
Code
5. ViewController.h
//UIScrollview’s name is SclView.
@property (weak, nonatomic) IBOutlet UIScrollView *SclView;
6.ViewController.m
Set sizes at viewDidLayoutSubviews.
– (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
//Set Contentsize(Same size, set at No2. eg:640)
[self.SclView setContentSize: CGSizeMake(640.0, 420)];
//Set the Size of ScrollView( Contentsize > ScrollView’s Size)
self.ScrollContainer.frame = CGRectMake(self.ScrollContainer.frame.origin.x, self.ScrollContainer.frame.origin.y, 320, 420);
}
So build it and Run !