One problem with today's project is that when you click the button provided by a third-party library, the effect of the animation makes the status bar font color automatically black, but the status bar has a black background, so it looks like the status bar disappears, but the button is the content in the third-party library. , cannot be modified, what I think here is to prohibit the automatic change of font color in status bar. The specific implementation is as follows:
1. Add a new key:uiviewcontrollerbasedstatusbarappearance in the project's. plist file
2. Set the value of this key to No
3. Add the following line of code to the Didfinishlaunchingwithoptions: method:
Application.statusbarstyle = uistatusbarstylelightcontent;
This way, the status bar will always be white.
This is one way, but there is another way to solve this problem, which is explained in detail in Apple's official Transitionguide.pdf file:
the first method is as stated in the first paragraph:
A good way to dynamically change the system status bar is to override the Preferredstatusbarstyle method, update the appearance of the status bar with an animation module, and call the Setneedsstatusbarappearanceupdate method.
The second method is for me, which is what the note says:
Does not allow the view controller to automatically adjust the style of the status bar, You need to add the Uiviewcontrollerbasedstatusbarappearance key to the Info.plist file and set its value to No, and then call the Uiapplicationstatusbarstyle method to set its style.
iOS Development-Disable the view controller to automatically adjust the style of the status bar