Technical Q&A QA1588
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.
Important All file names are case sensitive.
iPhone-only applications:
iPhone-only applications may only have one launch image. It should be in PNG format and measure 320 x 480 pixels. Name your launch image file Default.png
.
For iPhone 4 high resolution, you can include an additional launch image. It should be in PNG formate and measure 640 x 960 pixels. Name it [email protected]
. This image will get picked up by the iOS if your app is running on an iPhone 4.
Note: If your app is not running on an iPhone 4, and you provided both Default.png
and [email protected]
, iOS will automatically pick up Default.png
as the launch image.
iPad-only applications:
Create a launch image for each supported orientation in the PNG format. Each launch image must be 1024 x 748 pixels (for landscape) or 768 x 1004 pixels (for portrait).
Default launch image files:
Default-PortraitUpsideDown.png
- upside-down portrait version.
Default-LandscapeLeft.png
- left-oriented landscape version.
Default-LandscapeRight.png
- right-oriented landscape version.
Default-Portrait.png
- generic portrait version.
Default-Landscape.png
- generic landscape version.
Default.png
- default portrait launch. Its usage is strongly discouraged, use more specific launch images instead.
Note: For iPad-only applications, it is common 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 iOS Application Programming Guide for more information.
Universal applications:
Include launch images for both iPhone and iPad. iPhone launch image will still be named Default.png
and [email protected]
. Name your iPad portrait launch image Default-Portrait.png
(do not useDefault.png
as the iPad portrait launch image).
In your Info.plist
file:
Specify values for the UISupportedInterfaceOrientations
key for the supported orientations.
Specify values for the UIInterfaceOrientation
key for the initial launch orientation.
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 iOS Application Programming Guide.
In your UIViewController
class, implement the -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
method to return the supportedUIInterfaceOrientation
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.
Date | Notes |
---|---|
2011-03-17 | Corrected the dimensions for iPad launch images. |
2010-08-06 | Included more information on launch images for iPhone-only and universal apps. |
2010-06-01 | Corrected the dimension for iPad portrait launch image. Changed the context to apply only for automatic orientation support. |
2010-05-17 | New document that describes the required steps to automatically support orientations for iPhone and iPad apps. |