#ifdef #else #endif选择iOS sdk版本和功能? [英] #ifdef #else #endif choose iOS sdk version and function?
问题描述
我正在建造一个黑暗主题的iOS 6和7应用程序。我知道我可以调用 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
来使iOS 7状态栏适合深色主题应用。
I am buliding a dark themed iOS 6 and 7 app. I understand I can call [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
to make the iOS 7 status bar suit a dark color theme application.
问题是我要将我的应用程序提交到App Store,目前Xcode 5尚未准备就绪,所以我必须使用Xcode 4.6.x来完成这项任务。但是使用Xcode 4.6,我无法从iOS 7编译新方法。我想我必须做类似如果ios7然后执行 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
并重新定位我的应用程序窗口。
The problem is I am going to submit my app to the App Store and currently Xcode 5 is not ready for that, so I have to use Xcode 4.6.x to do this task. However with Xcode 4.6, I am not able to compile the new method from iOS 7. I think I have to do something like ""if ios7"" then do [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
and reposition my application window.
我试图用 #ifdef
... #else
...
此代码 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
在 viewDidLoad $内C $ C>。
I am trying to do this with #ifdef
... #else
...
this code is [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
inside the viewDidLoad
.
任何人都可以帮助理解如何在某些函数中使用 #ifdef
... ...
Could anyone help to understand how to use #ifdef
... with the method in some functions.
非常感谢!!!!
推荐答案
虽然我'我不是100%肯定我可以在不违反保密协议的情况下完全回答这个问题,我会尽力指出你正确的方向。
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.
你需要使用 __ IPHONE _ *
在Availability.h中的#defines
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
请注意 #if
和 #ifdef
将确定什么代码编译,它不是运行时检测机制。
Please be aware that #if
and #ifdef
will determine what code is compiled, it is not a runtime detection mechanism.
您可以通过快速使用Open并键入可用性轻松访问Availability.h 。
You can easily access Availability.h by using Open Quickly and typing in Availability.
这篇关于#ifdef #else #endif选择iOS sdk版本和功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!