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;
}

posted @ 2016-08-24 17:08  会飞的夜良  阅读(159)  评论(0)    收藏  举报