0

在我的应用程序中,我有一个UITabBarController,其中包含3个UINavigationController。我可以冻结任何UIViewController的方向。为此,我实施了UITabBarControllerUINavigationController。但是当我从景观中的另一个推动UIViewController时会发生问题。新推送的UIViewController应该是纵向的,但它仍然在横向。我知道问题可能不清楚,所以我附上scrrenshots。视图控制器的固定方向

让我们考虑它的VC-A。

enter image description here

从VC-A按编辑进入到这个VC-B。 VC-B是:

enter image description here

该VC-B应该总是肖像。 VC-A可以是横向或纵向。当VC-A是在景观和我按编辑的VC-B推和VC-B来在横向模式下,虽然我实现了在VC-B这些方法:

-(BOOL)shouldAutorotate { 
    return UIInterfaceOrientationMaskPortrait; 
} 

-(NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskPortrait; 
} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationPortrait; 
} 

回答

0

shouldAutorotate需要返回BOOL不在屏蔽,所以代码应该是

-(BOOL)shouldAutorotate { 
    return YES; 
} 
+0

那不是问题所在。 – Rashad

相关问题