ios - 是否可以更改所有 View Controller 的状态栏颜色?

标签 ios swift uiviewcontroller statusbar uicolor

我已经搜索了一段时间,但我只找到了描述在一个 View Controller 上更改颜色而不是所有 View Controller 的答案。

有可能吗?

最佳答案

只需要两步就可以改变整个应用的状态栏样式。 🙂

第一步

向项目的 Info.plist 文件添加一个新属性并将其设置为 false

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

第二步

转到项目的目标并在常规/部署信息下,将状态栏样式默认切换到Light.

The Status Bar Style option can be found right under the device orientation selectors of the Xcode project's editor.

执行这些步骤将确保状态栏在整个项目中的行为相同。

关于ios - 是否可以更改所有 View Controller 的状态栏颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47749652/

相关文章:

ios - 静态 UITableView 的更新部分

swift - 在 Xcode 中的导航栏 Controller 的标题下添加副标题

ios - Google Cast iOS 示例应用程序未扫描设备

ios - 每次单击按钮时可以更改背景图像吗?

ios - 处理添加任务意图,siri kit

ios - 如何强制 iOS 设备通过陀螺仪确定其方向?

ios - 设置为半透明时导航栏变为透明

objective-c - PushViewController 失败

ios - 在 Table View 中,当在 tableview 中滚动时,标签会被其他文本重叠。

ios - UICollectionViewCell 中的按钮不起作用