@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 指定页面添加 屏幕固定
最新推荐文章于 2021-01-06 16:27:04 发布