我已经在互联网上搜索了很久,但仍然找不到解决方法。我正在尝试使我的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方法不会触发。我需要在旋转时进行一些图像交换,但是我无法得到任何指示即将发生旋转的迹象。
提前感谢。