質問

I'm using NavigationController with NavigationBar visible. I read from here Bars and Bar Buttons that

Black, if using UIBarPositionTopAttached. Provided by the window background, if using UIBarPositionTop.

First, I make my ViewController conform to UIBarPositioningDelegate and implement

- (UIBarPosition)positionForBar:(id <UIBarPositioning>)bar
{
    return UIBarPositionTop;
}

I then use a 44px height image for NavigationBar

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar_background"]
                                                forBarMetrics:UIBarMetricsDefault];

and set window background color

self.window.backgroundColor = [UIColor greenColor];

but the result is that the StatusBar background color is still black. I want it to be green

Why and how to fix this ?

正しい解決策はありません

他のヒント

You won't be needing this answer, but I came across the same issue

I just used image of size (320 x 64) And covered the background area of status bar, thus black parts were discarded, You can add some other bg for top 20 pixels, which will cover the status bar

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top