typedef NS_ENUM(NSInteger, UIDeviceOrientation) //设备方向

{

UIDeviceOrientationUnknown,

UIDeviceOrientationPortrait,                   // 竖向,头向上

UIDeviceOrientationPortraitUpsideDown,  // 竖向,头向下

UIDeviceOrientationLandscapeLeft,         // 横向,头向左

UIDeviceOrientationLandscapeRight,       // 横向,头向右

UIDeviceOrientationFaceUp,                   // 平放,屏幕朝下

UIDeviceOrientationFaceDown                // 平放,屏幕朝下

};

typedef NS_ENUM(NSInteger, UIDeviceBatteryState) //电池状态

{

UIDeviceBatteryStateUnknown,

UIDeviceBatteryStateUnplugged,   // 未充电

UIDeviceBatteryStateCharging,     // 正在充电

UIDeviceBatteryStateFull,             // 满电

};

typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) //用户界面类型

{

//iOS3.2以上有效

#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED

UIUserInterfaceIdiomPhone,           // iPhone 和 iPod touch 风格

UIUserInterfaceIdiomPad,              // iPad 风格

#endif

};

#define UI_USER_INTERFACE_IDIOM() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? [[UIDevice currentDevice] userInterfaceIdiom] : UIUserInterfaceIdiomPhone)

#define UIDeviceOrientationIsPortrait(orientation)  ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown)

#define UIDeviceOrientationIsLandscape(orientation) ((orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight)

NS_CLASS_AVAILABLE_IOS(2_0) @interface UIDevice : NSObject {

@private

NSInteger _numDeviceOrientationObservers;

float     _batteryLevel;

struct {

unsigned int batteryMonitoringEnabled:1;

unsigned int proximityMonitoringEnabled:1;

unsigned int expectsFaceContactInLandscape:1;

unsigned int orientation:3;

unsigned int batteryState:2;

unsigned int proximityState:1;

} _deviceFlags;

}

+ (UIDevice *)currentDevice; // 获取当前设备

@property(nonatomic,readonly,retain) NSString    *name;                // e.g. "My iPhone"

@property(nonatomic,readonly,retain) NSString    *model;               // e.g. @"iPhone", @"iPod touch"

@property(nonatomic,readonly,retain) NSString    *localizedModel;    // localized version of model

@property(nonatomic,readonly,retain) NSString    *systemName;      // e.g. @"iOS"

@property(nonatomic,readonly,retain) NSString    *systemVersion;    // e.g. @"4.0"

@property(nonatomic,readonly) UIDeviceOrientation orientation;       // 除非正在生成设备方向的通知,否则返回UIDeviceOrientationUnknown 。

@property(nonatomic,readonly,retain) NSUUID      *identifierForVendor NS_AVAILABLE_IOS(6_0);      // 可用于唯一标识该设备,同一供应商不同应用具有相同的UUID 。

@property(nonatomic,readonly,getter=isGeneratingDeviceOrientationNotifications) BOOL generatesDeviceOrientationNotifications; //是否生成设备转向通知

- (void)beginGeneratingDeviceOrientationNotifications;

- (void)endGeneratingDeviceOrientationNotifications;

@property(nonatomic,getter=isBatteryMonitoringEnabled) BOOL batteryMonitoringEnabledNS_AVAILABLE_IOS(3_0);  // 是否启动电池监控,默认为NO

@property(nonatomic,readonly) UIDeviceBatteryState batteryState NS_AVAILABLE_IOS(3_0);  // 如果禁用电池监控,则电池状态为UIDeviceBatteryStateUnknown

@property(nonatomic,readonly) float batteryLevel NS_AVAILABLE_IOS(3_0);  //电量百分比, 0 .. 1.0。如果电池状态为UIDeviceBatteryStateUnknown,则百分比为-1.0

@property(nonatomic,getter=isProximityMonitoringEnabled) BOOL proximityMonitoringEnabledNS_AVAILABLE_IOS(3_0); // 是否启动接近监控(例如接电话时脸靠近屏幕),默认为NO

@property(nonatomic,readonly)  BOOL proximityState NS_AVAILABLE_IOS(3_0);  // 如果设备不具备接近感应器,则总是返回NO

@property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupportedNS_AVAILABLE_IOS(4_0); // 是否支持多任务

@property(nonatomic,readonly) UIUserInterfaceIdiom userInterfaceIdiom NS_AVAILABLE_IOS(3_2); // 当前用户界面模式

- (void)playInputClick NS_AVAILABLE_IOS(4_2);  // 播放一个输入的声音

@end

@protocol UIInputViewAudioFeedback

@optional

@property (nonatomic, readonly) BOOL enableInputClicksWhenVisible; // 实现该方法,返回YES则自定义的视图能够播放输入的声音

@end

UIKIT_EXTERN NSString *const UIDeviceOrientationDidChangeNotification; // 屏幕方向变化通知

UIKIT_EXTERN NSString *const UIDeviceBatteryStateDidChangeNotification   NS_AVAILABLE_IOS(3_0); // 电池状态变化通知

UIKIT_EXTERN NSString *const UIDeviceBatteryLevelDidChangeNotification   NS_AVAILABLE_IOS(3_0); // 电池电量变化通知

UIKIT_EXTERN NSString *const UIDeviceProximityStateDidChangeNotification NS_AVAILABLE_IOS(3_0); // 接近状态变化通知

UIDevice-b的更多相关文章

  1. Uiautomator 2.0之UiDevice新增API学习小记

    1. InstrumentationRegistry类 1.1. 类说明: 一个暴露的注册实例,持有instrumentation运行的进程和参数,还提供了一种简便的方法调用instrumentati ...

  2. iOS 整理笔记 获取手机信息(UIDevice、NSBundle、NSLocale)

    /*    iOS的APP的应用开发的过程中,有时为了bug跟踪或者获取用反馈的需要自动收集用户设备.系统信息.应用信息等等,这些信息方便开发者诊断问题,当然这些信息是用户的非隐私信息,是通过开发ap ...

  3. iOS - YYAdd对UIDevice的拓展

    YYKit中对UIDevice的拓展,accumulate knowledge !!! 首先 #include <sys/socket.h> #include <sys/sysctl ...

  4. iOS的UIDevice,NSBundle,NSLocale

    iOS的APP的应用开发的过程中,有时为了bug跟踪或者获取用反馈的需要自动收集用 户设备.系统信息.应用信息等等,这些信息方便开发者诊断问题,当然这些信息是用户的非隐私信息,是通过开发api可以获取 ...

  5. IOS设备 UIDevice 获取操作系统 版本 电量 临近手机触发消息检测 (真机亲测可用)

    - (void)viewDidLoad { [super viewDidLoad]; // 操作系统 NSString * osName =[[UIDevice currentDevice]syste ...

  6. 获取iOS系统版本 --- UIDevice

    UIDevice类是一个单例,其唯一的实例( [UIDevice currentDevice] ) 代表了当前使用的设备. 通过这个实例,可以获得设备的相关信息(包括系统名称,版本号,设备模式等等). ...

  7. iOS - UIDevice

    前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIDevice : NSObject @available(iOS 2.0, *) public class UI ...

  8. iOS开发 获取手机信息(UIDevice,NSBundle,NSlocale)

    在开发中,需要获取当前设备的一些信息,可以通过UIDevice,NSbundle,NSlocale获取. UIDevice UIDevice 提供了多种属性,类函数及状态通知,可以检测手机电量,定位, ...

  9. UIDevice通知

    UIDevice通知 UIDevice类提供了一个单例对象,它代表着设备,通过它可以获得一些设备相关的信息,比如电池电量值(batteryLevel).电池状态(batteryState).设备的类型 ...

  10. UIDevice 系统信息详解

    获取当前设备    //获取当前设备    UIDevice *dev = [UIDevice currentDevice]; 设备和系统基本信息    NSLog(@"设备名称:%@&qu ...

随机推荐

  1. C# ArrayList 基本用法 分类: C# 2014-09-26 11:03 524人阅读 评论(0) 收藏

    首先说明一下ArrayList 与 数组的区别: (1)ArrayList 的容量可以根据需要自由扩充,数组的容量是固定的 (2)ArrayList 只能是一维形式,数组可以是多维的 (3)Array ...

  2. 【设计模式 - 3】之建造者模式(Builder)

    1      模式简介 建造者模式也叫生成器模式,和抽象工厂模式相似,也是一种构建复杂对象的模式. 建造者模式中的角色分类: 抽象建造者Builder:接口类型,用于规范各个产品的组成部分: 具体建造 ...

  3. jQuery之DOM

    jQuery之DOM 1.jQuery属性. 获取元素属性的语法: attr(name)                   例子:$("#img1").attr("sr ...

  4. 高级性能调试手段(oprofile+gprofile)+内核追踪手段:LTT

    http://blog.csdn.net/wlsfling/article/details/5876134http://www.lenky.info/archives/2012/03/1371http ...

  5. Linux命令之dot - 绘制DOT语言脚本描述的图形

    本文链接:http://codingstandards.iteye.com/blog/840055 用途说明 Graphviz (Graph Visualization Software的缩写)是一个 ...

  6. Change Fragment layout on orientation change

    Warning: this may be a pre-Lollipop answer. A Fragment doesn't get re-inflated on configuration chan ...

  7. svn 1.8.11 命令行提交新添加文件错误

    由于公司的svn服务器版本不兼容最新的svn 1.8.11导致 提交代码报错 ➜  images  svn ci arrowico.png -m"add images for png ico ...

  8. MAC 环境下 初始化新的mysql root 密码

    mac 环境下初始化mysql的root密码 关掉mysql服务,打开系统设置最后的mysql,然后将mysql先关掉 生成一个文件命名mysql-init,文件中放入:一句话,这句话不同版本不一样, ...

  9. 学习微信小程序之css15解决父盒子高度塌陷

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. BFC与IFC

    在我们做的网页上通常最重要的其中一点就是美观度,bfc他是一个块级格式化上下文,它是一个独立的渲染区域,只有Block-level box参与, 它规定了内部的Block-level Box如何布局, ...