Xcode 4.6中iOS7的statusBar

时间:2013-08-22 08:59:00

标签: ios objective-c xcode ios7

我想解决iOS7中statusBar的问题。我找到了this post,这个解决方案在Xcode 5中运行得很好。但是当我在Xcode 4.6.3中尝试这个代码时,我遇到了2个错误:

  1. No visible @interface for 'MyController' declares the selector 'setNeedsStatusBarAppearanceUpdate';
  2. Use of undeclared identifier 'UIStatusBarStyleLightContent'
  3. 使用此代码解决了第一个问题:[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];但我无法解决第二个错误。

1 个答案:

答案 0 :(得分:12)

这些是iOS 7的功能,无法在XCode 4.6.3中编译,它试图针对iOS 6进行编译。您需要有条件地将它们编译出来。

用以下内容包装有问题的代码:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    //iOS 7 only stuff here
#endif