I have a UIScrollView with a textfield and a UIImageView in it. I'm trying to make it scroll vertically (with support for device rotation to landscape v. portrait) but no matter what I do, it only scrolls horizontally instead of vertically and I have no idea why.
I have read a lot about autolayout and scrollview so I thought it might be an autolayout issue. However, I have already configured the autolayout to handle the rotation switch to landscape so I'd like to keep it on. The subviews are added through the storyboard to the scrollview.
I'm also in general confused about contentSize of the scrollView. Should this be larger than the screen size like in the documentation? I also saw a stackoverflow question in which it was supposed to be the same size as the screen which confused me.
- (void)viewDidLoad
{
[super viewDidLoad];
[self.scrollView setDelegate:self];
self.scrollView.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+400);
}
-(void)orientationChanged:(NSNotification *)notification{
self.scrollView.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+400);
}