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文件中)
就搞定了。