Why won't basic UIScrollView with a few buttons scroll?
So all I have done is:
But still after all this in the iPhone simulator it won't let me scroll the view?
Only one more thing you have to do: set the contentSize
property on your scroll view to an appropriate value:
[scrollView setContentSize:CGSizeMake(
scrollView.bounds.size.width,
CGRectGetMaxY(bottommostSubview.frame)
)];
Where bottommostSubview
is an outlet connected to the subview of the scrollview that’s closest to the bottom. You could also write a method to find this view automatically, or just hard-code a value if you know the size will never change.
The default contentSize
is CGSizeZero
which effectively disables scrolling.