iOS特殊界面旋屏设置的方法之一

1.AppDelegate.h

@property (assign, nonatomic) BOOL allowRotation;

2.AppDelegate.m

#pragma mark - 自动旋屏相关
-(UIInterfaceOrientationMask)applicaxtion:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

{
    if (self.allowRotation) {
        
        return UIInterfaceOrientationMaskAll;
    }
    
    return UIInterfaceOrientationMaskPortrait;
    
}

3.viewController.m

#pragma mark - 设置是否自动转屏
- (BOOL)shouldAutorotate
{
    return YES;
}

转载于:https://www.cnblogs.com/MrXHong/p/5803788.html

你可能感兴趣的:(iOS特殊界面旋屏设置的方法之一)