With Xcode 4.5.2 I created a Single View Application. Using Interface Builder I populated the view with an UIScrollView. In my view controller I added an outlet like so:
@interface ScrollerViewController : UIViewController {
IBOutlet UIScrollView *_scrollView;
}
I connected the outlet using Interface Builder to the actual scroll view.
The viewDidLoad of the view controller method is
- (void)viewDidLoad
{
[super viewDidLoad];
[_scrollView setContentSize:CGSizeMake(320, 700)];
}
Running the application now I can scroll the scroll view like I would expect. I can see that is working because the scroll bars appear when I swipe the view.
Now when I drop a label (or a button) inside the scroll view the scroll view stops working. It does not scroll anymore. The label does not move and the scroll bars do not appear. It works (scrolls) again when I remove the label.
Any Idea what I an missing?
EDIT:
You can find my toy project on GitHub.
I think that the scrolling only works if the content size is larger than the frame of the scroll view. So try making it larger if it isn`t.
Hope this helps!
EDIT:
Ok, found the problem. Turn off the auto layout from IB.