iphone, ipad, ios的启动图片。

Technical Q&A QA1588


Technical Q&A QA1588

Automatic orientation support for iPhone and iPad apps

Q:  What is needed to 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 Images

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 Default@2x.png. 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 Default@2x.png, 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 Default@2x.png. Name your iPad portrait launch image Default-Portrait.png (do not useDefault.png as the iPad portrait launch image).

Update Your Info.plist Settings

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.

Implement -shouldAutorotateToInterfaceOrientation: Method

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.



Document Revision History

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.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值