I created a custom navigation bar and I need to change the status bar's color to be the same as the navigation bar's background color:
- (void)drawRect:(CGRect)rect {
CGFloat logoWidth = CGRectGetWidth([self frame]) / 4;
CGFloat logoHeight =CGRectGetHeight([self frame]) / 2;
[kAPPLogo drawInRect:CGRectMake((CGRectGetWidth([self frame]) - logoWidth) / 2, (CGRectGetHeight([self frame]) - logoHeight) / 2, logoWidth, logoHeight)];
self.barTintColor = kNavicationBarColor;
self.backgroundColor = kNavicationBarColor;
}
I tried this:
self.barTintColor = kNavicationBarColor
but it did not work. Can anybody help?
Status bar background color is transparent so no need to change it and it's content color is available in only two colors white and black. To change it's content color override the method
preferredStatusBarStyle
like given belowcall this method in
viewDidLoad
Even then you want to change background color of status bar, you can do that by following code: