在iOS中以编程方式更改Info.plist键的值 [英] Change the value of Info.plist key programmatically in ios

查看:406
本文介绍了在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.

您可以做什么:

  1. 将基于ViewController的状态栏外观"设置为是"
  2. 为您的所有视图控制器(例如:"BaseViewController")创建超类
  3. 覆盖方法

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

(UIStatusBarStyle)preferredStatusBarStyle

(UIStatusBarStyle)preferredStatusBarStyle

在那里设置您的默认样式

Set your default style there

这篇关于在iOS中以编程方式更改Info.plist键的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆