且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们如何在当前使用iOS 13的iOS应用中支持暗模式?

更新时间:2023-12-04 19:38:46

以下是添加颜色逻辑的代码,该代码应在黑暗模式下出现.

Here is the code for adding your color logic should appear in the dark mode.

if self.traitCollection.userInterfaceStyle == .dark {

  //Add your Dark mode colors here
 } else {

  //Your normal colors should appear here
 }

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

To know more about adapting dark mode in your iOS application please refer to the following blog post.

如何在iOS应用中采用iOS 13暗模式

How to Adopt iOS 13 Dark Mode in your iOS App