保持iPhone在横向旋转? [英] Keep iPhone rotation in landscape?

查看:63
本文介绍了保持iPhone在横向旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个仅在横向模式下运行的应用程序,但是我发现当我旋转设备时,该应用程序会自动旋转到该方向.我在项目摘要中指定只希望向左横向",然后在我放置的每个视图控制器中

I'm making an app that is only in landscape mode but I've found that when I rotate the device, the app auto-rotates to that orientation. I specified in the project summary that I wanted only "Landscape Left" and then in each view controller I put

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

尽管当我单击向右或向左旋转"时,应用程序以横向启动,但模拟器会按原样进入纵向,但应用程序也会自动旋转.即使设备旋转,如何使应用程序保持横向?

Although the app starts in landscape when I click rotate right or left, the simulator goes into portrait as it should but then the app auto-rotates as well. How can I get the app to stay in landscape even when the device is rotated?

推荐答案

除了您所做的之外,代替您的 shouldAutorotateToInterfaceOrientation 函数,请使用以下

In addition to what you did, Instead of your shouldAutorotateToInterfaceOrientation function, use the following

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

这篇关于保持iPhone在横向旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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