#ifdef #else #endif choose iOS sdk version and function?

后端 未结 2 1601
囚心锁ツ
囚心锁ツ 2021-01-05 15:10

I am buliding a dark themed iOS 6 and 7 app. I understand I can call [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; to make

2条回答
  •  无人及你
    2021-01-05 15:59

    While I'm not 100% sure I can fully answer this without breaching NDA, I'll do my best to point you in the right direction.

    You need to use the __IPHONE_* #defines in Availability.h

    #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
      // iOS 6+ code here
    #else
      // Pre iOS 6 code here
    #endif
    

    Please be aware that #if and #ifdef will determine what code is compiled, it is not a runtime detection mechanism.

    You can easily access Availability.h by using Open Quickly and typing in Availability.

提交回复
热议问题