iOS开发之判断横竖屏

判断横屏
if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeRight || 
[UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeLeft) { //当前横屏 } else { //当前竖屏 }
判断竖屏
if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationPortrait || 
[UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationPortraitUpsideDown) {
    //当前竖屏
} else {
   //当前横屏
}

 

posted @ 2019-11-15 17:50  kawerd  阅读(3382)  评论(0编辑  收藏  举报