user2900772
user2900772

Reputation: 321

Change status bar colour in slide out menu

I have a slide out menu and no matter what I try, I can't get the status bar area colour to change. I don't know what's wrong.

Picture 1:

enter image description here

Picture 2:

enter image description here

Picture 1 shows the app with the menu out. Picture 2 shows how the storyboard layout

I would have thought this would be simple as I've changed the global status bar colour using UINavigationBar appearance

Does anyone know what I'm doing wrong?

Upvotes: 0

Views: 1936

Answers (3)

user2900772
user2900772

Reputation: 321

For anyone that's using SASlideMenu and wondering how to do this. The fix is simple, just add a view to Slide Menu Root View Controller that covers the status bar area. When you change the background colour of this view, it colours the status bar area on the menu.

Upvotes: 0

user2535467
user2535467

Reputation:

The status bar in iOS7 is transparent. From Apple:

Because the status bar is transparent, the view behind it shows through. The style of the status bar refers to the appearance of its content, which includes items such as time, battery charge, and Wi-Fi signal. Use a UIStatusBarStyle constant to specify whether the status bar content should be dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent).

So if it is not changing although you have altered the value in IB, you could try to set the value programmatically, like so:

- (UIStatusBarStyle)preferredStatusBarStyle
{
     return UIStatusBarStyleLightContent; //or UIStatusBarStyleDefault
}

The above only changes the color of the text and icons in the status bar between black (UIStatusBarStyleDefault) and white (UIStatusBarStyleLightContent).

As stated by Apple, the bar itself is translucent, so it will be the same color as the view behind it.

Upvotes: 0

arturdev
arturdev

Reputation: 11039

You can use this slide menu library: https://github.com/arturdev/AMSlideMenu

Here you can customize status bar by any view. Just call:

- (void)fixStatusBarWithView:(UIView *)view;

here view must be with height of 20px;

Upvotes: 0

Related Questions