【问题标题】:Xcode 4.3 running application in PortraitXcode 4.3 纵向运行应用程序
【发布时间】:2012-07-24 11:54:18
【问题描述】:
嗨,我正在创建一个 iOS 应用程序,我希望它一直在纵向上运行,即使我向左/向右转动它我希望它在这里保持不变,这里有一些与纵向相关的所有设置的图像。
这就是我设置的所有内容,所以我的问题是,即使我在它运行的那一刻倾斜它,我如何保持纵向,它会以纵向打开,但如果我向左转,它会旋转到横向.
在此先感谢您,我期待您的到来。
【问题讨论】:
标签:
ios
xcode4
xcode4.3
portrait
device-orientation
【解决方案1】:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
使用此方法只支持纵向模式
【解决方案2】:
对于您从此函数支持的任何方向返回 YES。
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}