【发布时间】:2012-10-08 04:20:01
【问题描述】:
我一直在互联网上寻找解决方案,但一无所获。我正在尝试使我的 iOS 5 应用程序与 iOS 6 兼容。我无法让方向的东西正常工作。我无法检测到何时将发生轮换。这是我正在尝试的代码:
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
// pre-iOS 6 support
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
新的supportedInterfaceOrientation: 方法被调用得很好。但是, shouldAutorotate 方法不会触发。我需要在旋转时进行一些图像交换,但没有任何迹象表明旋转即将发生。
提前致谢。
【问题讨论】:
-
这里有答案:stackoverflow.com/questions/12260261/… 看到它:D
-
@KarenAnne,该答案并不能解决首先没有调用“shouldAutorotate”的问题。此外,“shouldAutorotateToInterfaceOrientation”在 iOS 6 中已被弃用,因此不应将其视为未来的有效选项。
标签: iphone ios cocoa-touch rotation ios6