Xcode 4.6中iOS7的statusBar [英] statusBar for iOS7 in Xcode 4.6
问题描述
我想解决iOS7中 statusBar
的问题。我找到了这篇文章和这个解决方案在Xcode 5中工作得很好。但是当我在Xcode 4.6.3中尝试这个代码时,我遇到了2个错误:
I want to resolve issue with statusBar
in iOS7. I have found this post and this solution works great in Xcode 5. But when I tried this code in Xcode 4.6.3 I got 2 errors:
-
'MyController'没有可见的@interface声明选择器
;
'setNeedsStatusBarAppearanceUpdate' -
使用未声明的标识符
。
'UIStatusBarStyleLightContent'
No visible @interface for 'MyController' declares the selector 'setNeedsStatusBarAppearanceUpdate'
;Use of undeclared identifier 'UIStatusBarStyleLightContent'
.
使用此代码解决了第一个问题: [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
但我无法解决第二个错误。
The first problem was solved by using this code: [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
but I can't resolve the second error.
推荐答案
这些是不能在XCode 4.6.3中编译的iOS 7功能,它试图针对iOS 6进行编译。您需要有条件地将它们编译出来。
These are iOS 7 features that won't compile in XCode 4.6.3 which is trying to compile against iOS 6. You need to conditionally compile them out.
用以下内容包装有问题的代码:
Wrap the offending code with:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
//iOS 7 only stuff here
#endif
这篇关于Xcode 4.6中iOS7的statusBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!