您的位置:首页 > 其它

关于横竖屏切换获取和设置布局的补充

2015-04-27 11:07 441 查看
在我开发的时候使用的是通知的方式获取,屏幕的改变,通过

[[UIDevice
currentDevice] orientation] 的方法确实能够获取屏幕的方向。

typedef
NS_ENUM(NSInteger, UIDeviceOrientation) {
UIDeviceOrientationUnknown,

UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom 竖屏 home键在末端

UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top 竖屏 home键在上面

UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right 横屏

UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left 横屏
UIDeviceOrientationFaceUp,
// Device oriented flat, face up 扁平,方向操上
UIDeviceOrientationFaceDown
// Device oriented flat, face down 扁平,方向操下
};

我们在测试的时候往往也就用到了 ,一般就是横竖 屏

但是 我们如果使用这个的时候,我们测试时候一般就是放在水平上面,这时 检查到的是 扁平。如果我们只要做的是横竖屏适配检测的话,我建议最好是判断电池的方向来获取。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: