OGeek|极客世界-中国程序员成长平台

标题: ios - 我们如何在 iOS 13 的当前 iOS 应用中支持暗模式? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 16:12
标题: ios - 我们如何在 iOS 13 的当前 iOS 应用中支持暗模式?

我当前的应用程序是用 objC 和 Swift 开发的。我需要支持暗模式。谁能建议我如何在全局范围内实现这一目标?



Best Answer-推荐答案


这里是添加颜色逻辑的代码,应该出现在深色模式中。

if self.traitCollection.userInterfaceStyle == .dark {

  //Add your Dark mode colors here
 } else {

  //Your normal colors should appear here
 }

要了解有关在 iOS 应用程序中调整暗模式的更多信息,请参阅以下博客文章。

How to Adopt iOS 13 Dark Mode in your iOS App

关于ios - 我们如何在 iOS 13 的当前 iOS 应用中支持暗模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56679376/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4