iOS 代码判断设备的系统及型号

1.判断iOS设备系统的版本号:获取iOS设备系统版本很简单只需一句代码即可



//返回一个float类型的数值根据这个数据就可以获取设备系统号

[[UIDevice currentDevice]systemVersion] floatValue]

有了上面的方法我们可以设置宏,判断iOS设备的系统号


2





//ios7宏

#define iOS7 (([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0)&&([[[UIDevice currentDevice]systemVersion] floatValue] < 8.0))

//ios8宏

#define iOS8 ([[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0)

//ios6宏

#define iOS6 (([[[UIDevice currentDevice]systemVersion] floatValue] >= 6.0)&&([[[UIDevice currentDevice]systemVersion] floatValue] < 7.0))

2.获取iOS设备的型号我们也可以通过上述的函数来获取


NSLog(@"设备型号什么%@",[[UIDevice currentDevice] name]);


你可能感兴趣的:(ios,设备)