iOS7中的状态栏背景颜色



im从ios6开始兼容的应用程序。在iOS 7状态栏中,栏是重叠的视图和导航栏。我想要iOS 6样式的状态栏。就像它应该出现在所有UI对象,视图,ViewController和Navigation Controller上方。我们该如何实现这一目标?

用于修复重叠问题的问题,只需在ios7

中尝试此链接状态栏和导航栏问题

使用状态栏样式类似于iOS 6,此链接可能会帮助您更改状态栏样式

在您的应用程序委托的应用程序didfinishlaunching方法中:

[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];

设置uistatusbarstyleblacktranslucent/uistatusbarstyleblackopaque获得类似于ios6的状态栏。

希望这可以帮助您

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

首先 -> 转到您的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;
   }

最新更新