[英]iPhone - Landscape Only App
I am trying to make an app that will only be viewed in Landscape. 我正在尝试制作仅在横向视图中查看的应用程序。 I have looked up some tutorials (albeit older ones) and have done the following:
我查阅了一些教程(尽管是较旧的教程),并做了以下工作:
-set up the info.plist to include a key for uiinterfaceorientation -设置info.plist以包括用于uiinterfaceorientation的密钥
-in the main view controller I have set the frame to be 480 x 320 -在主视图控制器中,我将帧设置为480 x 320
Now, the first screen loads up ok. 现在,第一个屏幕加载正常。 Everything is where it should be and whatnot.
一切都应该在什么地方,什么都没有。 However, if I click a button that is set to present a modal view controller nothing happens.
但是,如果单击设置为显示模式视图控制器的按钮,则不会发生任何事情。 Everything is linked and coded correctly but nothing happens when I press the button.
一切都正确链接和编码,但是当我按下按钮时什么也没有发生。 Am I doing something wrong with trying to force landscape?
我在尝试强制景观时做错了什么吗?
At it's basic, this question is a how do you effectively make an app that will only be in landscape mode? 从根本上讲,这个问题是如何有效地制作仅处于横向模式的应用程序? Thanks for any help.
谢谢你的帮助。
You should only uncomment this method I show you below: 您只应取消注释此方法,以下将向您展示:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.