iOS UIScrollView Scroll View Content Size


The contentSize property must be set to the size of the scrollable content. This specifies the size of the scrollable area. Scrolling is visible when scrollable area i.e. contentSize is larger than the UIScrollView frame size.

With Autolayout:

When the scroll view's content is set up using autolayout, it must be explicitly sized both vertically and horizontally and have all 4 edges pinned to the containing scroll view. That way, the contentSize is calculated automatically based on the scroll view's contents and also gets updated when the content's layout is changed.



scrollview.contentSize = CGSize(width: 640, height: 800)


scrollview.contentSize = CGSizeMake(640, 800);