设备的方向
来源:互联网 发布:汇编语言与c语言区别 编辑:程序博客网 时间:2024/05/18 00:37
iOS方向
1、UIDeviceOrientation
设备方向,只读。
typedefNS_ENUM(NSInteger,UIDeviceOrientation) { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom UIDeviceOrientationPortraitUpsideDown,// Device oriented vertically, home button on the top 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}__TVOS_PROHIBITED;
获取当前设备的方向:[UIDevice currentDevice].orientation;
2、UIInterfaceOrientation
软件方向,可读可写。
typedef NS_ENUM(NSInteger, UIInterfaceOrientation) { UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown, UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft} __TVOS_PROHIBITED;
获取当前软件的方向:UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
3、使用
当设备横屏时UIDeviceOrientation与UIInterfaceOrientation的方向刚好相反。
监听设备方向变化:
//注册通知监听设备方向变化(注册通知前需要先调用beginGeneratingDeviceOrientationNotifications,当然结束时也需要调用endGeneratingDeviceOrientationNotifications) [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
0 0
- 判断设备的方向
- 设备的方向
- 获取Android设备的方向
- 获取Android设备的方向
- 获取Android设备的方向
- ios 获得设备的方向
- 获取Android设备的方向
- 获取Android设备的方向
- 加速度 陀逻计的设备方向的使用
- IOS判断设备当前的方向
- usb 设备的端点 及输入输出方向
- 如何识别ios设备的方向
- android 利用sensormanager获取设备的方向
- 获取Android设备的方向 -- gsensor
- 获取设备屏幕方向变化的代码
- 检测移动设备方向的改变
- iOS监听设备方向的方法
- 使用加速计获取设备的方向
- ebay接口实例(Finding api --- 搜索商品)
- 没有苹果开发账号,只有p12文件和mobileprovision文件进行打包
- Android在DeskTop添加快捷方式
- 使用azkaban调度spark任务
- 01字典树 小结
- 设备的方向
- 马上成为 PaperTask.cn 认证译员!双倍翻译价格等着您!
- Druid、BoneCP、DBCP、C3P0等主流数据库对比
- 算法学习笔记之概率算法
- Bellman-ford algorithm to find the shortest path
- iTunesconnect 审核被拒经验总结
- 一个很不错的H5动画网站
- Java集合总结
- Libevent触发模式