UIScrollView won't scroll!

You need to set UIScrollView.contentSize to match the total scrollable size, which is your subview frame size in this case.


As mentioned in the accepted answer, you must set the UIScrollView's contentSize property.

This can be done in Interface Builder.

  1. Select the scroll view
  2. Select the 'identity inspect' in Utilities pane on the right
  3. Under 'User Defined Runtime Attributes' click the '+' button
  4. Set the 'Key Path' value to 'contentSize'
  5. Set the 'Type' value to 'Size'
  6. Set the 'Value' value to '{width, height}' (eg: '{320, 600}')

Build and run and your scroll view will scroll.

The content inset does not affect scrolling. See What's the UIScrollView contentInset property for?


To scroll, you have to make the scrollview's frame smaller than its content, the contained image or view.