iphone - iOS 6 自动旋转的问题

标签 iphone objective-c ios ipad

我有一个 View Controller ,我希望它只以纵向显示,所以我在 iOS 6 中做了以下操作:

-(BOOL)shouldAutorotate
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

但是,当我旋转设备时,它仍然会变成横向。知道在哪里可以检查这个吗?我设置了一个断点,它到达了 supportedInterfaceOrientations ,但它仍然旋转

最佳答案

你有导航 Controller 吗? iOS6 决定什么可以自动旋转的方式已经改变。它正确地为您的 View Controller 询问supportedInterfaceOrientations,但它可能向您的导航堆栈层次结构中的另一个元素询问“shouldAutorotate”并接受该答案。如果您的 navigationController/tabviewController 对此问题返回"is",则它不会咨询您的 View Controller 。

关于iphone - iOS 6 自动旋转的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12826062/

相关文章:

ios - Realm Swift EXC_BAD_ACCESS 在 Segue 与非持久对象

ios - UINavigationController 仅在第二次出现 View 时隐藏后退按钮

iphone - ABRecordRef vCard

ios - 在 iOS 中每秒更新一次 TableView 中单元格中标签的文本

ios - 如何将可选的 UIImage 附加到数组

iphone - IOS 不编码加号 (+) 登录 x-www-form-urlencoded POST 请求?

iphone - 如何在 iOS 中使用 TrueType 付费字体

android - Windows 上的跨平台开发 (iOS/Android/Blackberry)

ios - UITableView 行在重新排序时快速重复

iphone - 核心电话框架在 4.0 中部分公开