我有以下控制器,(在iPad上我選擇了所有類型的方向性模式)力控制器改變自己的方向在縱向或橫向
這裏是我的iPad故事板佈局
Custom NavigationController > Loading Ctrl > Main Controller.
我的自定義導航包含
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
在我載入控制器
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
的supportedInterfaceOrientations被稱爲像往常一樣,一切似乎確定,但是當我使用performSegue
-(NSUInteger)supportedInterfaceOrientations
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM())
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
else
return UIInterfaceOrientationMaskPortrait;
}
在MainController沒有更多的電話把我的主控制器。這是爲什麼?
這個工作對我來說:http://stackoverflow.com/questions/22491786/force-landscape-viewcontroller-in-ios-7/22491787#22491787 –