覆盖 UINavigationBar 时,iOS 7 状态栏变黑

问题描述:

我正在继承 UINavigationBar 以便我可以覆盖 drawRect 方法.但是,当我在 iOS 7 中这样做时,状态栏变成完全黑色.根本没有文字.在 iOS 6 中它没有这个问题;状态栏是它应该在的地方.

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?

2014 年 4 月 15 日更新

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.

我找到了一个解决方案.文本最初是黑色背景上的黑色.我还没有想出如何使背景透明,但我想有白色文本就足够了.

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://*.com/a/18184831/3400034