I have set up a UIScrollView
with which I want to display 12 images (only 8 fit on screen) laid out horizontally. In the following image you can see the problem
Insert: [scrollView setContentSize:CGSizeMake(x,y)];
in the following method:
-(void)viewWillAppear:(BOOL)animated
Two Solutions:
Create different constraints that can be satisfied simultaneously (you will have to edit). I think the problem is your bottom space and top space constraints are mutually exclusive. please remove one and try again. IF this is difficult for you, try adding another UIView
to contain the UIScrollView
to help manage your constraints, it might seem odd at first, but sometimes adding another view to contain your view actually makes it simpler at each level.
Turn off Autolayout, and change the autoresize masks of your UIImageView
to be what you wish.
Try to set your scrollView's Content size int "viewDidLayoutSubviews" method with keeping the autolayouts set.
-(void)viewDidLayoutSubviews
{
[self.itemList setContentSize:CGSizeMake(required_width, required_height)];
}