iOS UIDevice设备信息,传感器设置,横竖屏判断操作,手机电池操作
来源:互联网 发布:手机复制软件下载 编辑:程序博客网 时间:2024/05/16 15:54
1、UIDevice是设备的信息相关的类,里面包含了很多手机设备的信息,包括版本号,手机名字等等。
2、一些属性的简单介绍:
+ (UIDevice *)currentDevice; // 获取当前的唯一设备@property(nonatomic,readonly,strong) NSString *name; // 只读属性,手机的名称,比如“My iPhone“@property(nonatomic,readonly,strong) NSString *model; // 手机的模型 比如“iPhone“@property(nonatomic,readonly,strong) NSString *localizedModel; // 本地化的模型@property(nonatomic,readonly,strong) NSString *systemName; // 系统名称 比如“iOS“@property(nonatomic,readonly,strong) NSString *systemVersion; // 系统版本号@property(nonatomic,readonly) UIDeviceOrientation orientation; // 当前设备的取向,横屏,竖屏,旋转屏幕的时候用到@property(nullable, nonatomic,readonly,strong) NSUUID *identifierForVendor; // 设备的UUID唯一标示,注意上线产品不要获取,会被拒的@property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported; // 是否支持多任务@property(nonatomic,readonly) UIUserInterfaceIdiom userInterfaceIdiom; // UI的显示样式,手机,iPad,TV
传感器设置
@property(nonatomic,getter=isProximityMonitoringEnabled) BOOL proximityMonitoringEnabled; // 是否开启距离传感器检测,默认为NO,@property(nonatomic,readonly) BOOL proximityState; // 当前设备的传感器开启状态,
横竖屏判断:
UIDeviceOrientationPortrait, // 竖屏UIDeviceOrientationPortraitUpsideDown, // 竖屏UIDeviceOrientationLandscapeLeft, // 横屏UIDeviceOrientationLandscapeRight, // 横屏BOOL UIDeviceOrientationIsPortrait(UIDeviceOrientation orientation) // 判断手机的当前屏幕是否是竖屏,用来做屏幕的旋转BOOL UIDeviceOrientationIsLandscape(UIDeviceOrientation orientation) // 判断手机的当前屏幕是否是横屏,用来做屏幕的旋转
手机电池操作
UIDeviceBatteryStateUnknown,UIDeviceBatteryStateUnplugged, // 没有充电UIDeviceBatteryStateCharging, // 充电状态,未充满电UIDeviceBatteryStateFull, // 充满电@property(nonatomic,getter=isBatteryMonitoringEnabled) BOOL batteryMonitoringEnabled; // 是否开启手机电池检测,默认NO,如果要获取手机电池的电量,状态等,需要打开设置开关@property(nonatomic,readonly) UIDeviceBatteryState batteryState; // 手机电池的状态,充电中,未充电,已经充满等,如果电池的没有开启检测,默认返回UIDeviceBatteryStateUnknown@property(nonatomic,readonly) float batteryLevel; // 手机电量,要获取真实数据,必须打开电池检测,
0 0
- iOS UIDevice设备信息,传感器设置,横竖屏判断操作,手机电池操作
- UIDevice 设备信息 iOS
- statusBarOrientation设备状态判断--- 横竖屏设置
- IOS获取设备系统信息(UIDevice,NSLocale)
- 【iOS开发系列】UIDevice设备信息
- UIDevice,设备信息
- UIDevice 设备信息
- UIDevice 设备信息
- UIDevice 设备信息
- UIDevice,设备信息
- UIDevice 设备信息
- UIDevice 设备信息
- iOS开发-Swift获取手机设备信息(UIDevice)
- 【最新iOS获取设备信息】:UIDevice,NSBundle,NSLocale
- iOS中通过UIDevice获取设备的部分信息
- IOS设备信息判断
- iOS中项目设置设备不可横竖屏切换
- iOS横竖屏设置
- 隐马尔科夫模型
- iOS下PDF显示
- 深入浅出RxJava——在Android中使用响应式编程
- 2016校招内推 -- 阿里巴巴前端 -- 四面面试经历
- 【第六章】 AOP 之 6.6 通知参数 ——跟我学spring3
- iOS UIDevice设备信息,传感器设置,横竖屏判断操作,手机电池操作
- Web报表工具JS开发之日期校验
- 【BZOJ3873】[Ahoi2014]拼图【分类讨论】【暴力】
- 从Google与eBay的系统架构学到的经验
- 一些常用的jQuery插件
- 原根
- OkHttp介绍
- Dobbo的继任者?试用微博RPC框架Motan
- Servlet——Session(2)之简单应用