0

I have a custom navigation bar showing a logo with an image and the status bar appears white. I'd like to be able to set the status bar color to match the greyish background of the logo.

http://i.imgur.com/wn0oOX5.png

When a cell is selected, I have the navigation bar going back to default and the status bar matches the navigation bar.

http://i.imgur.com/btQOvXn.png

LogoNavBar.m:

- (CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(self.frame.size.width, 90);
    return newSize;
}

- (void)drawRect:(CGRect)rect
{
    UIImage *image = [UIImage imageNamed:@"logo.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}

MasterViewController.m:

- (void)viewDidLoad
{
    [self.navigationController setValue:[[LogoNavBar alloc]init] forKeyPath:@"navigationBar"];
}

DetailViewController.m:

- (void)viewDidLoad
{
    [self.navigationController setValue:[[UINavigationBar alloc]init] forKeyPath:@"navigationBar"];
}

I've tried:

[[UINavigationBar appearance] setBarTintColor:[UIColor *colorhere*]];

in the app delegate and elsewhere but to no luck.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
KaJe
  • 43
  • 4
  • `[self.navigationController setValue:[[LogoNavBar alloc]init] forKeyPath:@"navigationBar"];` this is a terrible idea! Setting the navigation bar is private API and you should not be using that. – Léo Natan Mar 14 '14 at 00:08
  • In order for the navigation bar to appear under the status bar, your view controller has to have extended layout enabled. Make sure it is set to `UIRectEdgeAll`. – Léo Natan Mar 14 '14 at 00:14
  • Here's the answer to what you are looking for. http://stackoverflow.com/questions/20668583/how-to-add-custom-navigation-bar-to-a-full-screen-vc-in-ios-7-and-make-it-tint-t – atastrophic Oct 11 '14 at 10:44

0 Answers0