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 batteryMonitoringEnabled NS_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 proximityMonitoringEnabled NS_AVAILABLE_IOS(3_0); // 是否启动接近监控(例如接电话时脸靠近屏幕),默认为NO

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

@property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported NS_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); // 接近状态变化通知

最新文章

  1. C#基础-FileStream实现多线程断点续传
  2. 【Alpha版本】十天冲刺——日志集合贴
  3. 大话设计模式C++版——抽象工厂模式
  4. css3动画由浅入深总结
  5. 创建一个Table View
  6. orale--varchar2(5) vs varchar2(5 byte) vs varchar2(5 char)
  7. Swif基本语法以及与OC比较三
  8. netty Getting Started--reference
  9. 关于.ToList(): LINQ to Entities does not recognize the method ‘xxx’ method, and this method cannot be translated into a store expression.
  10. Wcf序列化的循环引用问题1
  11. linux下mysql连接jar包的位置在哪里?
  12. 浅谈JavaScript中的字符串操作
  13. 特性(Attributes)
  14. 【Swift】swift中懒加载的写法
  15. sdut 2878 圆圈
  16. Linux 高性能服务器编程——socket选项
  17. dajngo cache,throttling
  18. 如何在java项目中使用lucene
  19. 001 Spark的简介以及入门
  20. Ollydbg

热门文章

  1. mybatis学习第(一)天
  2. 重写ScrollView实现两个ScrollView的同步滚动显示
  3. 机器学习 Support Vector Machines 2
  4. Mybatis学习--动态SQL
  5. Mybatis学习--Mapper XML文件
  6. 【LeetCode】066. Plus One
  7. iOS中使用NSInvocation
  8. 解决Mac 系统升级到 10.14.1后 IDA 在非英文输入法时启动crash的问题
  9. Mesos提交任务没有被执行
  10. 关系运算符 逻辑运算符 if 语句 switch语句