O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Paging

Paging works by moving the content in units of the width and/or height of the scroll view. The user experience is flipping horizontally through the car images. To accomplish this, each car image must be the width of the scroll view. And because each image is the same width, the size of the content view is the width of the scroll view times the number of images.

Replace setupScrollContents with the code in Listing 6-4.

Listing 6-4 Paging Version of CarImageViewController

- (void)setupScrollContent {     CGFloat scrollWidth = self.view.bounds.size.width;                      // 1     CGFloat totalWidth = scrollWidth * [carImageNames count];               // 2     UIView *carImageContainerView = [[UIView ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required