本文介绍了在iOS中以编程方式更改Info.plist键的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以在 ios 中以编程方式更改 info.plist 键的值吗?
就像我想在不同位置将基于视图控制器的状态栏外观" 的值更改为是"/否" 一样.
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.
推荐答案
您无法以编程方式更改info.plist中的值.
You can't change values in the info.plist programmatically.
您可以做什么:
- 将基于ViewController的状态栏外观"设置为是"
- 为您的所有视图控制器(例如:"BaseViewController")创建超类
-
覆盖方法
- Set "ViewControllerBased status bar appearance" to Yes
- Make a superclass for all your viewcontrollers (For example: "BaseViewController")
Override method
(UIStatusBarStyle)preferredStatusBarStyle
(UIStatusBarStyle)preferredStatusBarStyle
在那里设置您的默认样式
Set your default style there
这篇关于在iOS中以编程方式更改Info.plist键的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!