11

我阅读了有关禁用暗模式的 Apple 文章,因为我需要为所有 UIViewController 禁用并且我没有任何 BaseUIViewController。

如何在不使用任何 BaseUIViewController 的情况下为所有 UIViewController 禁用暗模式?我不想一遍又一遍地写下面的代码。

有针对这个的解决方法吗?

override func viewDidLoad() {
    super.viewDidLoad()

    // Always adopt a light interface style.    
    overrideUserInterfaceStyle = .light
}
4

1 回答 1

21

You can force light/dark mode in your whole application regardless of the user's settings by adding the key UIUserInterfaceStyle to your Info.plist file and setting its value to either Light or Dark.

于 2019-06-28T09:20:35.990 回答