仅适用于iPhone或iPad的风景模式 [英] Landscape Mode ONLY for iPhone or iPad

查看:191
本文介绍了仅适用于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

推荐答案

此处找到的代码


在横向模式下启动

Launching in Landscape Mode

在iPhone操作系统中的应用程序通常
在纵向模式下启动以匹配主屏幕的
方向。如果
有一个运行在
纵向和横向模式的应用程序,你的
应用程序应该始终启动
纵向模式,然后让
它的视图控制器旋转
接口根据需要基于
设备的方向。如果您的
应用程序仅以横向模式
运行,则必须执行
,然后执行
步骤,以使其最初以
横向方向启动。

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。

覆盖视图控制器的 shouldAutorotateToInterfaceOrientation:
方法,只对

所需的横向方向返回YES,对纵向方向返回否

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天全站免登陆