问题
Can we change the value of info.plist key programmatically in ios?
like I want to change the value of 'View controller-based status bar appearance' key to 'YES' / 'NO' in different places.
回答1:
You can't change values in the info.plist programmatically.
What you can do:
- Set "ViewControllerBased status bar appearance" to Yes
- Make a superclass for all your viewcontrollers (For example: "BaseViewController")
Override method
(UIStatusBarStyle)preferredStatusBarStyle
Set your default style there
- Override this method in any other subclass where want you to differ from that style
来源:https://stackoverflow.com/questions/19509673/change-the-value-of-info-plist-key-programmatically-in-ios