iphone - 在 ios 7 中方向颠倒时 View 不会旋转

标签 iphone objective-c ios7 uiinterfaceorientation

我尝试让应用程序支持所有方向。它工作正常,但只有颠倒方向不起作用。我用的是ios7。对于颠倒 View 不旋转。我尝试了以下代码

-(BOOL)shouldAutorotate  
{
return yes;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // etc
}

我唯一调用了第二个方法,但没有调用第一个方法。在 infoPlist 中,我启用了所有支持的方向。

最佳答案

找到了修复方法。主要来源:https://stackoverflow.com/a/12758715/394969

对于首先登陆这里的人来说,简而言之:

/* In your view controller */
// Add support for upside down 
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

还可以在项目设置中打开所有设备方向,如 @Jignesh Mayani 的答案中所述。如果这不能立即解决您的问题,请检查上面的链接,了解如何使用导航 Controller 和选项卡 Controller (它们都必须支持所需的界面方向)。

关于iphone - 在 ios 7 中方向颠倒时 View 不会旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20159661/

相关文章:

iphone - 在 Core Graphics 中调整图像大小

ios - 更改 TableView 单元格颜色将不起作用

uitableview - ios7 UITableViewCell SelectionStyle 不会变回蓝色

ios - 模仿Facebook隐藏/显示扩展/收缩导航栏

objective-c - iOS 7 过度导航栏按钮填充

iphone - 在 View Controller 中为 iPhone/iPad 动态加载 Nib

iphone - 样式文本字段 : iOS style

ios - Xamarin iOS IPv6 应用商店拒绝

objective-c - 从 UIViewController 绘制虚线

objective-c - 如何判断 NSPanel 是否不再在 View 中?