系统信息获取


@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                             
    //屏幕朝下平躺
};


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值