I have the following constellation:
Main View (Custom UIViewController, no navigationcontroller or navigation bar), containing a button which segues modally to a second Table view controller, which is embedded in a Navigation Controller:
MainView -> Navigation Controller -> TableView
On the MainView the status bar is Black (no changes with iOS 6 - even when Status Bar is set to Default) On the TableViewController the status bar should have Default Style (grey in iOS 5, Blue Tinted due to navigation bar in iOS 6).
In iOS 5 this was easy by the following lines of code in TableViewController:
if ([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarStyle:)]) {
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}
Running this under iOS 6 noting happens. How can I do this? I tried all possible Status Bar settings under project summary and in the plist (like described here: https://stackoverflow.com/a/12468689/1685971)
Also, in Storyboard everything looks fine. Running the app in simulator or on the device it looks different:
try this "hack": You have to add a navigation bar to your first view controller. Then you have two possibilities.
1) Set the alpha value of the navigation bar to 0
or
2) Set the y-position of the bar to -43px (look here: http://moduscreate.com/tinting-your-status-bar-in-ios6-and-phonegap/)
EDIT:
To get the right colors you have to set the tintColor of the invisible UINavigationBar. So by default set it black. In your button action you have to set the tintColor to your navigationController.navigationBar.tintColor. At the action of your close button you need to set it back to [UIColor blackColor].
The first view controller must have a navigation controller/bar for the feature to work. The status bar does not change color throughout your app (in iOS6) but adapts to the navigationbar color of you starting view. If your starting view does not contain a navigationbar, the status bar does not adapt color.! (See http://i.stack.imgur.com/n9ubK.png)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With