Domanda

I'm all out of ideas on how to get this to work.

I need the status bar to match the colour of the Nav bar, with the Nav bar being transparent. For some reason however, it's only working for 3 quarters of the status bar.

Here it is in portrait. With the slide in masterView's status bar being black. Portrait

And landscape. No idea why it's black at the far right. Landscape

Does anyone know why it would be doing this? The status bar is supposed to take on the colour of the navigation bar. But it just isn't working.

  • I've tried setting background images to the Navigation Bars.
  • I've tried setting a colour to the Navigation Bar background.

This is the code in my AppDelegate that adds the blue to the status bar.

UIView *statusBarBlue = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.window.frame.size.width, 20)];
[statusBarBlue setBackgroundColor:[UIColor colorWithRed:0.219 green:0.554 blue:0.719 alpha:1.000]];
[self.window.rootViewController.view addSubview:statusBarBlue];

Opening up a new project and pasting that code in to your AppDelegate will get the same thing I'm seeing.

If I extend the width of the statusBarBlue view, to say like 2000, the black status bar in the landscape is removed. However, in portrait, the black is still there.

I'm all out of ideas. Any nudges in the right direction would be very helpful.

È stato utile?

Soluzione

I managed to get this to work by just setting the navigation bar colour.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top