Automatic orientation support for iPhone and iPad apps

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 Images
iPhone 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:
  • 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.
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:
  • 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 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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值