0

我正在开发一个从 ios6 开始兼容的应用程序。在 iOS 7 状态栏是重叠的视图和导航栏。我想要 iOS 6 风格的状态栏。就像它应该出现在所有 UI 对象、视图、视图控制器和导航控制器之上。我们怎样才能做到这一点?

4

2 回答 2

1

要修复重叠问题,只需尝试此链接Status bar and navigation bar issue in IOS7

对于使用类似于 ios 6 的状态栏样式,此链接可以帮助您更改 StatusBar 样式

在您的应用委托的 applicationDidFinishLaunching 方法中:

[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];

设置 UIStatusBarStyleBlackTranslucent/UIStatusBarStyleBlackOpaque 以获取类似于 iOS6 的状态栏。

希望这可以帮助你

于 2014-03-13T10:10:57.943 回答
1

我迟到了这个答案,但我只想分享我所做的,这基本上是最简单的解决方案

首先->转到您的info.plist文件并添加Status Bar Style->Transparent Black Style(Alpha of 0.5)

现在,它开始了:-

将此代码添加到您的 AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
     //Whatever your code goes here
  if(kDeviceiPad){

     //adding status bar for IOS7 ipad
         if (IS_IOS7) {
              UIView *addStatusBar = [[UIView alloc] init];
              addStatusBar.frame = CGRectMake(0, 0, 1024, 20);
              addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //change this to match your navigation bar
              [self.window.rootViewController.view addSubview:addStatusBar];
                    }
                }
    else{

         //adding status bar for IOS7 iphone
        if (IS_IOS7) {
            UIView *addStatusBar = [[UIView alloc] init];
            addStatusBar.frame = CGRectMake(0, 0, 320, 20);
            addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //You can give your own color pattern
            [self.window.rootViewController.view addSubview:addStatusBar];
        }

    return YES;
   }
于 2014-03-13T10:43:53.753 回答