系统信息获取
2016-01-04 14:17
190 查看
@property(nonatomic,readonly,strong) NSString *name; // e.g. "My iPhone" @property(nonatomic,readonly,strong) NSString *model; // e.g. @"iPhone", @"iPod touch" @property(nonatomic,readonly,strong) NSString *localizedModel; // localized version of model @property(nonatomic,readonly,strong) NSString *systemName; // e.g. @"iOS" @property(nonatomic,readonly,strong) NSString *systemVersion; // e.g. @"4.0" @property(nonatomic,readonly) UIDeviceOrientation orientation; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.
测试:
NSLog(@"%@", device.name); //用户自定义终端名 NSLog(@"%@", device.model); //型号名 NSLog(@"%@", device.localizedModel); //本地型号名 NSLog(@"%@", device.systemName); //OS名 NSLog(@"%@", device.systemVersion); //OS版本 NSLog(@"%ld", (long) device.orientation);//屏幕方向
输出:
2016-01-04 14:20:28.319 01-Myproject[711:11710] iPhone Simulator 2016-01-04 14:20:28.320 01-Myproject[711:11710] iPhone 2016-01-04 14:20:28.320 01-Myproject[711:11710] iPhone 2016-01-04 14:20:28.321 01-Myproject[711:11710] iOS 2016-01-04 14:20:28.321 01-Myproject[711:11710] 9.1 2016-01-04 14:20:28.321 01-Myproject[711:11710] 0
其中屏幕方向:
typedef NS_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 //屏幕朝下平躺 };
相关文章推荐
- centos 手动安装网卡驱动
- htm页面中<a name>加name和id的冲突附解决方法
- 浅谈html中id和name的区别实例代码
- JavaScript中为元素加上name属性的方法
- js使用for循环及if语句判断多个一样的name
- Display SQL Server Version Information
- 关于Unsupported major.minor version 49.0的错误解决办法
- PHP中使用php://input处理相同name值的表单数据
- IE中document.createElement的iframe无法设置属性name的解决方法
- Android中Android Virtual Device(AVD)使用教程
- PHP 中 Orientation 属性判断上传图片是否需要旋转
- Apache No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
- Python中if __name__ == '__main__'作用解析
- Python version 2.7 required, which was not found in the registry
- Python中__name__的使用实例
- Python中if __name__ == "__main__"详细解释
- .class bad version问题小计
- 使用GitHub进行版本管理
- android检测设备方向
- 启动hive命令报错 “Metastore contains multiple versions”