代码全部禁止横屏 AppDelegate内
- (UIInterfaceOrientationMask )application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
可选页面禁止横屏或开启
在appdelegate 内添加 通知方法
- (void)initializeNotificationCenter
{
//在进入需要全屏的界面里面发送需要全屏的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startFullScreen) name:@"APPstartFullScreen" object:nil];
//在退出需要全屏的界面里面发送退出全屏的通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endFullScreen) name:@"APPendFullScreen" object:nil];
}
#pragma mark 进入全屏
-(void)startFullScreen
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.allowRotation = YES;
}
#pragma mark 退出横屏
-(void)endFull