ios 屏幕旋转的设置方法和英文解释

用这个方法在appDelegate适配

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
     //
     if (_isHP == YES) {
          [[NSNotificationCenter defaultCenter]postNotificationName:@"HPL" object:nil];
          return UIInterfaceOrientationMaskAll; //四个方向
          
     }else{
          return UIInterfaceOrientationMaskPortrait; //竖直方向
     }
}

- (BOOL)shouldAutorotate {
    return YES;//支持转屏
}

备注方向英文解释
UIInterfaceOrientationMaskPortrait//home键在下 UIInterfaceOrientationMaskLandscapeLeft//支持向左旋转 UIInterfaceOrientationMaskLandscapeRight//支持向右旋转 UIInterfaceOrientationMaskPortraitUpsideDown//支持上下 UIInterfaceOrientationMaskLandscape//支持左右同时旋转 UIInterfaceOrientationMaskAll//支持四个方向 UIInterfaceOrientationMaskAllButUpsideDown//支持上左右

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容