ios – Modal UINavigationController – 我无法停止旋转
发布时间:2020-12-14 17:39:27 所属栏目:百科 来源:网络整理
导读:我正在使用故事板,我在UITabBarController中嵌入了UINavigationController. 我推出一个视图控制器然后从这个视图控制器我提出了一个带UIViewController的MODAL UINavigationController. 问题是,当模态视图之前的所有视图都不能时,模态视图控制器可以旋转. 如
我正在使用故事板,我在UITabBarController中嵌入了UINavigationController.
我推出一个视图控制器然后从这个视图控制器我提出了一个带UIViewController的MODAL UINavigationController. 问题是,当模态视图之前的所有视图都不能时,模态视图控制器可以旋转. 我试过添加: -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 和 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } 谢谢 解决方法
尝试分类UINavigationController
@implementation UINavigationController (Rotation_IOS6) -(BOOL)shouldAutorotate { return [[self.viewControllers lastObject] shouldAutorotate]; } -(NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] supportedInterfaceOrientations]; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation]; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |