使用SDK8.1我允许纵向方向,在.plist上左右横向。我有
1)导航控制器
@implementation OrientationRespectfulNavigationController
- (BOOL)shouldAutorotate
{
BOOL retVal = [super shouldAutorotate];
if (self.topViewController)
retVal = [self.topViewController shouldAutorotate];
return retVal;
}
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger retVal = [super supportedInterfaceOrientations];
if (self.topViewController)
retVal = [self.topViewController supportedInterfaceOrientations];
return retVal;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
UIInterfaceOrientation retVal = [super preferredInterfaceOrientationForPresentation];
if (self.topViewController)
retVal = [self.topViewController preferredInterfaceOrientationForPresentation];
return retVal;
}
2)UIViewController A
-(BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
2)UIViewController B
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape | UIInterfaceOrientationMaskPortrait;
}
所以,我以纵向启动应用程序。我看到ViewController A.然后我也以纵向推送到ViewController B.然后我旋转移动设备,B改变为风景。好。但是,为什么当我回到ViewController A出现在风景中?我怎么能永远用肖像强迫A?我证明了很多事情,我无法在stackoverflow中找到解决方案
由于