我有这样的子类 UINavigationController :
- (BOOL)shouldAutorotate {
if (self.topViewController != nil) return [self.topViewController shouldAutorotate];
else return [super shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations {
if (self.topViewController != nil) return [self.topViewController supportedInterfaceOrientations];
else return [super supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
if (self.topViewController != nil) return [self.topViewController preferredInterfaceOrientationForPresentation];
else return [super preferredInterfaceOrientationForPresentation];
}
supportedInterfaceOrientations
并且shouldAutorotate
在推入堆栈的每个视图控制器中都可以正常调用,但preferredInterfaceOrientationForPresentation
仅在使用 iOS 7 时调用一次。preferredInterfaceOrientationForPresentation
加载每个视图控制器时触发的任何想法都将不胜感激 =)
提前感谢,对不起我的英语=)