@interface UINavigationController (Autorotate)
@end
@implementation UINavigationController (Autorotate)
- (BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [self.topViewController preferredInterfaceOrientationForPresentation];
}
@end
- (BOOL)shouldAutorotate{
//是否允許轉屏
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
//viewController所支持的全部旋轉方向
// return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
/**支持 豎直方向*/
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//viewController初始顯示的方向
return UIInterfaceOrientationPortrait;
}
iOS 指定頁面添加 屏幕固定
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.