ChenYilong / ChenYilong/iOS13AdaptationTips

Dark Mode

Open
#9 15 comments 0 reactions 0 assignees View on GitHub
note
Dominant language
No language data
Stars
170
Forks
5
PR merge metrics
No merged PRs in 30d

Description

## Action

WWDC19:
> Apps on iOS 13 are expected to support dark mode
Use system colors and materials
Create your own dynamic colors and images Leverage flexible infrastructure

其中注意:

> Apps on iOS 13 are expected to support dark mode Use system colors and materials

审核强制要求适配黑夜模式,近在咫尺。

## Other

![](http://ww3.sinaimg.cn/large/006tNc79ly1g3ongsjzivj320d0u0npf.jpg)
![](http://ww1.sinaimg.cn/large/006tNc79ly1g3onhqs0djj31hc0u0e81.jpg)
![](http://ww2.sinaimg.cn/large/006tNc79ly1g3p3rmihdoj30wq0pr152.jpg)

## 正文

所以到底如何实现“五彩斑斓的黑”?

WWDC19上,提了案例,可以可以自己手动切换模式。比如给儿童做的app,可以只支持 Dark Mode ,plist设置后,对应页面、控件取到都是 Dark Mode 对应的值。

举例说明:

可以使用 `overrideUserInterfaceStyle` 属性控制ViewController的显示模式:

```Swift
class AlwaysDarkViewController: UIViewController {
required init?(coder: NSCoder) {
super.init(coder: coder)
self.overrideUserInterfaceStyle = .dark
}
}
```
既然给了plist可以设置,就是说明开发者有控制权。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.