Two ways to control StatusBar before IOS9:
The first way: Global control StatusBar
1. Set Uiviewcontrollerbasedstatusbarappearance to No in the project's Info.plist file.
2. Use [[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; method to set the color.
The second way: Controller-based control of the STATUSBAR1. Set Uiviewcontrollerbasedstatusbarappearance to Yes in the project's Info.plist file. 2. Control the color and status of the status bar in each uiviewcontroller. By implementing the following methods in the controller to set the status bar color status-(Uistatusbarstyle) Preferredstatusbarstyle
-(BOOL) Prefersstatusbarhidden
There are currently only two colors available: uistatusbarstylelightcontent-white character uistatusbarstyledefault-black word
-------------------------
The problem with the second approach is that if a controller is inside the Uinavigationcontroller, then the above method of controlling statusbar is not called.
Workaround: Let Uinavigationcontroller implement-(Uiviewcontroller *) Childviewcontrollerforstatusbarstyle method. Return the top-level controller. That's all you can do.
You can write a uinavigationcontroller category to implement this method. Included in the project.
-(Uiviewcontroller *) Childviewcontrollerforstatusbarstyle
{
return self.topviewcontroller;
}
Another: Model out of the controller, and Uinavigationcontroller itself is not affected!
IOS9, the sub-controller in the navigation controller sets the issue of StatusBar state failure