O'Reilly logo

Xcode 4 iOS Development by Steven F. Daniel

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

Time for Action – enabling Interface Rotation

To allow your application's interface to rotate and resize, all that is required is a single method. When the iPhone wants to check to see whether it should rotate your interface, it sends the shouldAutorotateToInterfaceOrientation: message to your view controller, along with a parameter that indicates which orientation it wants to check.

Your implementation of shouldAutorotateToInterfaceOrientation: should compare the incoming parameter against the different orientation constants in the iOS, by either returning TRUE (or YES) if you want to support that orientation.

The four basic screen orientation constants are described below:

ORIENTATION METHOD

iOS ORIENTATION CONSTANT

Portrait

UIInterfaceOrientationPortrait ...

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