1

I am subclassing the UINavigationBar so that I can override the drawRect method. However, when I do so in iOS 7, the status bar becomes completely black. No text at all. In iOS 6 it doesn't have that problem; the status bar is where it should be.

- (void)drawRect:(CGRect)rect // status bar goes pitch black
{
    [super drawRect:rect];
}

If I comment out this method, the status bar returns. How can I get the status bar back?

ios 7 with the drawRect override

ios 6 with the drawRect override


UPDATE Apr 15, 2014

I tried to set the status bar to something else using the code that I found here but it does not seem to have any effect.

Community
  • 1
  • 1
DerrickHo328
  • 4,054
  • 6
  • 24
  • 48
  • 1
    The black is the window. The status bar has text, but it's black too, and black on black is hard to see. In iOS 7 you can make the text white instead. – matt Apr 13 '14 at 21:43
  • ok, so I found out how to change the text color to white. But i'm not sure how to change the background color to something translucent. Iv'e tried playing with the status_bar_tinting_parameters > navigation_bar >Translucent> YES does not seem to do anything – DerrickHo328 Apr 15 '14 at 19:57
  • In iOS 7, the status bar is transparent, and you are supposed to increase the height of the navigation bar so that it comes up behind the status bar. Look at any standard iOS 7 app and that's what you'll see. – matt Apr 15 '14 at 19:59
  • For a standard navigation interface, this will happen automatically. If you are adding your own navigation bar to the interface, you have to do it yourself, in the way that I explain here: http://stackoverflow.com/a/22232805/341994 – matt Apr 15 '14 at 20:03
  • Probably your `drawRect:` override is messing up this whole thing in some way. – matt Apr 15 '14 at 20:03

1 Answers1

0

A solution I found. The text was initially black on top of a black background. I have not figured out how to make the background transparent, but I guess having white text is good enough.

https://stackoverflow.com/a/18184831/3400034

Community
  • 1
  • 1
DerrickHo328
  • 4,054
  • 6
  • 24
  • 48