1.识别当前系统版本,由于ios7 的statusBar 是悬空的,所以需要做下适配这样会避免屏幕下面出现白条,针对不同的版本显示内容布局不同
<pre name="code" class="objc"> int stateHeight = 0;
if ([UIDevice currentDevice].systemVersion.intValue>=7) {
stateHeight = 20;
}
2.
UIDevice 点开这个类里面还有其他系统信息可以获取与上面方法类似但不常用,通过单例来实现 来看看一下属性
@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; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated.