关于横竖屏切换获取和设置布局的补充
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 扁平,方向操下
};
我们在测试的时候往往也就用到了 ,一般就是横竖 屏
但是 我们如果使用这个的时候,我们测试时候一般就是放在水平上面,这时 检查到的是 扁平。如果我们只要做的是横竖屏适配检测的话,我建议最好是判断电池的方向来获取。
[[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 扁平,方向操下
};
我们在测试的时候往往也就用到了 ,一般就是横竖 屏
但是 我们如果使用这个的时候,我们测试时候一般就是放在水平上面,这时 检查到的是 扁平。如果我们只要做的是横竖屏适配检测的话,我建议最好是判断电池的方向来获取。
相关文章推荐
- Android横竖屏切换后,重新设置activity布局,ViewPager上无法正确显示Fragment
- android 动态设置横竖屏切换 控制dialog等布局文件加载的方法
- 关于安卓获取组件或布局的实际宽高和动态设置组件或布局的宽高
- 关于获取视图自动布局后的尺寸问题
- Android一些关于分辨率和布局的设置
- 关于 android 图片 文字 Button 自定义布局设置
- android设置横竖屏、可触控、获取分辨率等代码
- Android横竖屏切换View设置不同尺寸或等比例缩放的自定义View的onMeasure解决方案(2)
- 关于上篇修改打印机设置的补充.
- CCScene切换的所有特效(28种)以及设置屏幕横竖屏!
- 关于IIS布局设置问题的一些解决(window2003 server)
- Android横竖屏切换及其对应布局加载问题
- 关于利用js实现css切换布局视图的方法
- 关于获取焦点后、软盘弹出后布局不能上顶起来的问题
- android studio关于快捷键设置-切换eclipse中 alt+斜扛代码提示快捷键
- iOS 关于项目中某个界面需要横竖屏切换或者强制横屏
- android横竖屏切换和布局的问题
- 关于Android SDK Manager无法获取更新列表的正确设置
- Android WebView的使用(禁止超链接调用其他浏览器 设置滚动条 禁止横竖屏切换重新加载网页 )
- 横竖屏切换总结-布局改变和数据保存