문제

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