横向模式仅适用于 iPhone 或 iPad [英] Landscape Mode ONLY for iPhone or iPad

查看:34
本文介绍了横向模式仅适用于 iPhone 或 iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个不使用纵向模式的应用程序.

I want to create an application that doesn't use Portrait mode.

我不确定是否需要编辑 plist 或除了 plist 之外还有代码

I am not sure if I need to edit the plist or have code in addition to the plist

推荐答案

代码在这里找到

以横向模式启动

iPhone OS 中的应用程序正常以纵向模式启动以匹配主屏幕的方向.如果你有一个在两者中运行的应用程序纵向和横向模式,您的应用程序应始终启动最初的纵向模式,然后让它的视图控制器旋转接口根据需要设备的方向.如果你的应用程序以横向模式运行但是,您必须执行以下步骤使其在一个最初是横向.

Applications in iPhone OS normally launch in portrait mode to match the orientation of the Home screen. If you have an application that runs in both portrait and landscape modes, your application should always launch in portrait mode initially and then let its view controllers rotate the interface as needed based on the device’s orientation. If your application runs in landscape mode only, however, you must perform the following steps to make it launch in a landscape orientation initially.

  • 在应用程序的 Info.plist 文件中,添加 UIInterfaceOrientation
    键并将其值设置为
    横向模式.对于风景
    方向,您可以设置值
    这个键
    UIInterfaceOrientationLandscapeLeft

    UIInterfaceOrientationLandscapeRight.

以横向模式布置您的视图,并确保它们设置了自动调整选项正确.

Lay out your views in landscape mode and make sure that their autoresizing options are set correctly.

覆盖视图控制器的shouldAutorotateToInterfaceOrientation:方法并仅对
返回 YES所需的横向方向和 NO
用于纵向.

Override your view controller’s shouldAutorotateToInterfaceOrientation: method and return YES only for the
desired landscape orientation and NO
for portrait orientations.

这篇关于横向模式仅适用于 iPhone 或 iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆