Change the value of Info.plist key programmatically in ios [duplicate]

跟風遠走 提交于 2019-12-07 17:55:53

问题


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:

  1. Set "ViewControllerBased status bar appearance" to Yes
  2. Make a superclass for all your viewcontrollers (For example: "BaseViewController")
  3. Override method

    (UIStatusBarStyle)preferredStatusBarStyle

  4. Set your default style there

  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!