Technical Q&A QA1588 Automatic orientation support for iPhone and iPad apps |
Q: What is needed to automatically support multiple orientations in my iPhone and iPad apps? A: There are three things you must implement to automatically support orientations in your iPhone and iPad apps: provide launch images, update your Info.plist settings, and implement the -shouldAutorotateToInterfaceOrientation: method.
IMPORTANT: It is strongly recommended that your application support all orientations. This includes portrait, portrait upside-down, landscape left and landscape right. iPad apps that require an orientation must support both variants of that orientation. Provide Launch ImagesiPhone applications: You need one launch image in the PNG format. It must be 320 x 480 pixels and named Default.png. iPad applications: Create a launch image for each supported orientation in the PNG format. Each launch image must be 1004 x 768 pixels (for landscape) or 748 x 1024 pixels (for portrait). Default launch image files:
IMPORTANT: All file names are case sensitive.
Note: It is common for an application to provide only Default-Portrait.png and Default-Landscape.png. More specific launch images will take precedence over the generic versions, for example Default-PortraitUpsideDown.png takes precedence over the Default-Portrait.png image file for this specific orientation. See the "Providing Launch Images for Different Orientations" section on the iPad Programming Guide for more information. Back to Top ![]() Update Your Info.plist Settings In your Info.plist file:
Note: If you need to configure your iPad application differently from your iPhone application, you can specify device-specific values for Info.plist keys in iPhone OS 3.2 and later. See the "Creating a Universal Application" section in the iPad Programming Guide. Back to Top ![]() Implement -shouldAutorotateToInterfaceOrientation: Method In your UIViewController class, implement the -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation method to return the supported UIInterfaceOrientation constants. This method should return YES to support all orientations. See Q&A: Supporting orientations for iPad apps for supporting orientations in iPad apps. See Q&A: Why won't my UIViewController rotate with the device? for possible reasons your view controller does not rotate. |