在横向模式下锁定Ipad App [英] Lock Ipad App in Landscape mode

查看:152
本文介绍了在横向模式下锁定Ipad App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对iOS开发很陌生,所以请耐心等待。

I'm pretty new to iOS development so please bear with me.

我正在创建一个我想严格用于横向模式的应用。

I am creating an app that I want to strictly be used in landscape mode.

我编辑了.plist文件以包含这两个键:

I have edited the .plist file to include these two keys:

初始界面方向:横向(右侧)主页按钮)&
支持的界面方向:横向(右主页按钮)

Initial interface orientation: Landscape (right home button) & Supported interface orientation: Landscape (right home button)

我已将以下代码添加到ViewController.m中:

And I've added the following code to ViewController.m:

    }

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      return UIInterfaceOrientationIsLandscape(interfaceOrientation);
    }  

该应用程序当前正在模拟器中启动。它以横向模式启动,一切正常。但是,当按下一个按钮将我带到另一个场景时,我的问题就出现了。横向模式不适用于其他应用程序。

The app currently starts as it's supposed to in the simulator. It starts up in landscape mode and everything works just fine. However, my problem comes in when press a button that takes me to another "scene". The landscape mode doesn't carry throughout the rest of the apps.

所以我的问题是,我如何在整个应用程序中强制横向模式?

So my question is, how do I force landscape mode throughout my entire app?

推荐答案

你想在每个ViewController中有 shouldAutorotateToInterfaceOrientation:

You want to have shouldAutorotateToInterfaceOrientation: in each ViewController.

这篇关于在横向模式下锁定Ipad App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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