iOS 系统版本的判断

 iOS 宏定义系统版本的判断

#define iOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define iOS10_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 10.1f)
 
很多人都是用的这种方法,在此之前我也用的这种宏定义的方法,但是在xcode的开发环境中已经定义好了很多 系统版本判别的宏定义 包含iOS 、 Mac、TVOS、WATCHOS的系统版本的宏,截图如下:
  

 

 
只要在使用时 用下面的方法就可以了
 
#ifdef __IPHONE_7_0
  //iOS7的新特性代码
#endif
 
或者是使用:
 
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0
 
  //iOS7的新特性代码
#endif(__IPHONE_OS_VERSION_MAX_ALLOWED 这个定义是在Simulator-IOS7.0/usr/include/AvailabilityInternal.h文件中)
 
就搞定了。

 

转载于:https://www.cnblogs.com/Rong-Shengcom/p/6272460.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值