标签:ios statusbarorientation uiinterfaceorientati uiinterfaceorientati
iOS提供了一个方法 可以很简单的判断当前屏幕旋转到什么状态
UIInterfaceOrientation sataus=[UIApplication sharedApplication].statusBarOrientation;
得到结果是一个枚举类型
// Note that UIInterfaceOrientationLandscapeLeft is equal to UIDeviceOrientationLandscapeRight (and vice versa). // This is because rotating the device to the left requires rotating the content to the right. typedef NS_ENUM(NSInteger, UIInterfaceOrientation) { UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown, UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft };
UIInterfaceOrientationPortrait(Home键在下方)
UIInterfaceOrientationPortraitUpsideDown(Home键在顶部)
UIInterfaceOrientationLandscapeLeft(Home键在左侧)
UIInterfaceOrientationLandscapeRight(Home键在右侧)
还有一种unknow的情况 估计就是 检测不到
好了。
苹果开发群 :414319235 欢迎加入 欢迎讨论问题
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:ios statusbarorientation uiinterfaceorientati uiinterfaceorientati
原文地址:http://blog.csdn.net/lwjok2007/article/details/47174093