Since the latest design font for the app is the square font after iOS9, the app has the lowest support ios7,so ... To uniformly fit the font in the constant profile class, as follows:
// fit font, IOS9 and above system using new font--square font #if __iphone_os_version_max_allowed >= __iphone_9_0#define kFontSize15 [Uifont fontwithname:@] Pingfangsc-light "size:15.0"#else#define kFontSize15 [Uifont systemfontofsize:15.0]#endif
In the test environment of iOS8, print kFontSize15 is null, this shows that the above macro compiler condition to judge the condition is not correct, __iphone_os_version_max_allowed for the compiler, in different versions of the compiler Xcode, macro __ Iphone_os_version_max_allowed corresponds to a different version, xcode8.3 is like this:
#define __iphone_os_version_max_allowed __iphone_10_3
So, #if后的判断条件不对, and this judgment applies to those third-party service developers who need to be compatible with the high-low Xcode version to ensure that the latest API runs on the lower version of Xcode without compiling errors. Same
#ifdef __IPHONE_9_0 is the same as above, only ensure that your code is not error-prone when compiling in a low version.
Finally, the adaptation is written in such a way:
#define System_version ([[Uidevice Currentdevice] systemversion])#define Ios9_or_later (system_version.floatvalue >= 9.0)#define kFontSize15 ios9_or_later? [Uifont fontwithname:@ "Pingfangsc-light" Size:15.0]:[uifont systemfontofsize:15.0]
iOS system to determine certain adaptation __iphone_os_version_max_allowed