你如何使应用程序只支持景观? [英] how do you make an app ONLY support landscape?

查看:151
本文介绍了你如何使应用程序只支持景观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使应用程序仅支持景观?在xcode 3中,没有肖像模式只是整个景观吗?

how do you make an app ONLY support landscape? No portrait mode JUST landscape throughout the whole thing in xcode 3?

推荐答案

我天真的答案是在你的所有人中添加这个方法根视图控制器:

My naive answer is to add this method in all of your root view controllers:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
        return YES;

    return NO;
}

这就是我在游戏中所做的事情。当然,我的游戏只有一个视图控制器。

This is what I do in my game. Of course, my game only has one view controller.

另外,我发现在我的应用程序的info.plist中将初始界面方向设置为横向是有帮助的。

Also, I found it helpful to set "Initial interface orientation" in my app's info.plist to Landscape.

这篇关于你如何使应用程序只支持景观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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