WEB开发网
开发学院手机开发iPhone 开发 Apple关于iPad应用需要支持设备方向的要求 阅读

Apple关于iPad应用需要支持设备方向的要求

 2010-12-19 07:19:18 来源:WEB开发网   
核心提示:Technical Q&A QA1689Supporting orientations for iPad appsQ: Which orientations should my iPad application support?A: It is strongly recommended that your applic

Technical Q&A QA1689

Supporting orientations for iPad apps

Q: Which orientations should my iPad application support?

A: It is strongly recommended that your application support all orientations. This includes portrait, portrait upside-down, landscape left and landscape right.

If it is essential that your application run in only one orientation (for instance, portrait only), then you should:

Launch in your supported orientation, regardless of the current device orientation.

Avoid displaying any UI element that tells people to rotate the device.

Support both variants of an orientation.

IMPORTANT: You should always make your application support both variants of an orientation. More specifically, if your application supports portrait, then it should support both UIInterfaceOrientationPortrait and UIInterfaceOrientationPortraitUpsideDown; if your application supports landscape, then it should support both UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight.

When you are writing your application, consider using UIKit's interface orientation macros. In your UIViewController class, you should implement

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation to return:

UIInterfaceOrientationIsPortrait(interfaceOrientation) - if you support only portrait.

UIInterfaceOrientationIsLandscape(interfaceOrientation) - if you support only landscape.

Listing 1: Using an orientation macro in a portrait-only application

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsPortrait(interfaceOrientation);}Note: If you are using UIDeviceOrientation, note that the iPad simulator does not support the constants UIDeviceOrientationFaceUp,UIDeviceOrientationFaceDown or UIDeviceOrientationUnknown.

Tags:Apple 关于 iPad

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接