自iOS6以来,我意识到shouldAutorotateToInterfaceOrientation:
方法已被弃用。我的大多数应用程序都希望用户能够旋转,目前在iOS6和iOS5中可以工作。但是,我有我只想成为一个portrait
模式的看法,所以我增加了以下没有实际工作(在模拟器和设备测试):iOS6自动混淆并支持iOS5
// Tell the system what we support
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationPortrait;
}
// Tell the system It should autorotate
- (BOOL) shouldAutorotate {
return NO;
}
// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
为什么没有这个代码防止我的情态从旋转? 我还能如何支持iOS5方法以及iOS6方法,而不会导致iOS5用户崩溃?
模态是由家长提出的。如果有条件地停止父项的旋转,会发生什么 –
不,将它们放在父'viewController'中并不会停止旋转。 –
如果实现'shouldAutorotateToInterfaceOrientation:'它不会导致它在iOS 5上崩溃。只需实现'shouldAutorotateToInterfaceOrientation:'以及iOS 6方法。 – mattjgalloway