This is an important step: If you don’t tell the scroll view how large its subview is, it won’t know how to scroll at all.

Finally, add the scroll view to the main view:

[self.view addSubview:scrollView];

You’ll now see the scroll view with horizontal and vertical scroll bars indicating the current position in the image view
. You can hide these scroll bars using the showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties.

If you play around with the previous code, you’ll notice that if you scroll quickly to the edge of the subview, the scroll
view actually moves a little too far before springing back. This behavior is controlled by the bounce property. You can restrict bouncing to the x- or y-axis using the alwaysBounceHorizontal and alwaysBounceVertical properties, or you can disable it entirely by setting bounce to NO.

Zoom

You can also zoom in and out of an image using a scroll view. The minimumZoomScale and maximumZoomScale properties control the scale by which you can zoom in and out. By default, both of these properties are set to the same value
(1.0), which disables zooming. You must implement one of the UIScrollViewDelegate methods to return the view that is being zoomed.

Paging

Scroll views support the paging of their content—the ability to add multiple subviews as “pages” and then scroll between them as you might turn the pages
of a book. Adding a UIPageControl will provide a visual depiction of your current page .