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

Rotation

The only thing not working correctly is changing orientations. If you change to landscape, the images are not resized, and the scroll view pages based on its wider size. That means the paging is off.

You need to regenerate the content view when the screen rotates. Make two changes to make rotation work. First, add the following method below viewDidLoad:

- (void)willAnimateRotationToInterfaceOrientation:                 (UIInterfaceOrientation)toInterfaceOrientation                                          duration:(NSTimeInterval)duration {     [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation                                             duration:duration];     [self setupScrollContent]; ...

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