Scrolling Basics

Small screens make smartphones portable. They also limit the amount of information you can show. Sometimes information is bigger than the screen—for example a picture, a form with text fields, or a map.

On iOS, the solution is to scroll around. UIScrollView is a virtual window onto larger content. It provides all the support a user needs: dragging content around, zooming in and out, and all the other functionality an app might need.

The user drags or flicks a finger in a scroll view to slide the content around under a fixed “window.” Figure 6-1 shows changing what part of the content is viewed. The blue rectangle is what the user sees on an iOS device screen. The larger image is contained by the scroll view. The left side shows ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.