Uistatusbar is the status bar that displays battery and time information at the top of the app, with a width equal to the screen width and a height of 20. The display control of it is divided into two cases, one is when the program starts and the other is when the program is running.
1. When the program starts.
- In Info.plist, the value corresponding to the status bar is initially hidden (Uistatusbarhidden) is set to Yes, hidden when the program starts, and otherwise displayed. If you want to change its font color, set the value for status bar style (Uistatusbarstyle) to the type you want in info (uistatusbarstyelightcontent. )。
2. When the program runs
- Also in two cases, call it effects A and B bar, A is your view controller's status bar display is controllable, but the style is not controllable (all view controller's status bar is a style). b is you can control the display and style of each status bar. Add a key value to the Info.plist file: View controller-based status bar appearance, which means that each controller controls its own status bar individually.
- If you want a effect, set the view controller-based status bar appearance value to No, and then add the following code to the view controller to control whether the display is displayed or not.
[[UIApplication sharedapplication] Setstatusbarhidden:yes Withanimation:uistatusbaranimationfade];
Off-topic: If your view controller contains a Uinavigationbar, when you choose to hide the status bar, Uinavigationbar will appear unhealthy and the height from 64 to 44, the solution to this problem will be updated later.
Settings for iOS status bar (Uistatusbar)