Autorotation
Many applications rotate and resize all of their views when the user rotates the device. You could implement this using notifications, but it would be a lot of work. Thankfully, you can use autorotation to simplify the process.
If the view on screen is controlled by a view controller, when the device is rotated, the view controller is asked if it is okay to rotate the view. If the view controller agrees, the view is resized and rotated. Its subviews are also resized and rotated.
To implement autorotation in HeavyRotation, you need to do two things:
- Override shouldAutorotateToInterfaceOrientation: in HeavyViewController to allow autorotation.
- Carefully set the autoresize mask on each subview so that it acts reasonably when the ...
Get iOS Programming: The Big Nerd Ranch Guide, Second Edition 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.