0

i set background color of status bar using code below

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
    UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,320, 20)];
    view.backgroundColor = [UIColor colorWithRed:(31.0/255.0) green:(109.0/255.0) blue:(128.0/255.0) alpha:1];
    [self.window.rootViewController.view addSubview:view];
}

Also I set background color of my View in storyboard to exactly same color (R:31,G:109,B:128). But in result colors aren't same. Background color in status bar is brighter than in View.

In Info.plist I have Status bar style set to UIStatusBarStyleLightContent and View controller-based status bar appearance set to NO.

Is that because status bar is translucent?
How can I change that?
Thanks for any advice.

Popeye
  • 11,839
  • 9
  • 58
  • 91

1 Answers1

0

Maybe, change navigationbar state to opaque:

self.navigationController.navigationBar.translucent = NO;
nikhil84
  • 3,235
  • 4
  • 22
  • 43
fdlr
  • 101
  • 1
  • 11
  • 2
    self.navigationController.navigationBar.translucent = NO; – Dmitriy Kalachniuk Sep 15 '14 at 08:16
  • Thanks for answer, but there is no navigation bar, only status bar and view. When I set up navigation bar everything is OK, but I don't want navigation bar there. I would attach printscreen but I don't have enough reputation points... – user3305384 Sep 15 '14 at 09:40