ChenYilong / iOS13AdaptationTips

iOS13 AdaptationTips
MIT License
175 stars 6 forks source link

Dark Mode #9

Open ChenYilong opened 5 years ago

ChenYilong commented 5 years ago

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

正文

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

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

举例说明:

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

class AlwaysDarkViewController: UIViewController {
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        self.overrideUserInterfaceStyle = .dark
    }
}

既然给了plist可以设置,就是说明开发者有控制权。

linconz commented 5 years ago

Info.plist增加下列选项可以强制选择浅色或者深色模式

<key>UIUserInterfaceStyle</key>
<string>UIUserInterfaceStyleLight</string>
ChenYilong commented 5 years ago

ChenYilong commented 5 years ago

https://github.com/ChenYilong/CYLTabBarController/issues/386

xieweilyg commented 5 years ago

dark mode 苹果要求开发者必须适配吗?没有看到相关官方文档

ChenYilong commented 5 years ago

还没说必须

linconz commented 5 years ago

UIUserInterfaceStyle

更正一下,UIUserInterfaceStyle的value必须是Light或者Dark https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW44

否则包传不上去,但实际测试写UIUserInterfaceStyleLight是可以进入强制浅色模式的,也就是说iOS13的代码是支持,但是审核那里还没支持

ChenYilong commented 5 years ago

哈?没听懂,详细讲讲?

linconz commented 5 years ago

哈?没听懂,详细讲讲?

Info.plist里的key UIUserInterfaceStyle的值必须是Light或者Dark

PhilCai1993 commented 5 years ago

有人了解过Flutter的Dark mode适配吗

ChenYilong commented 5 years ago

iTeaTime(技术清谈)@BM-成都iOS:

Q:这个属性还提交不上去?

wangyanlong commented 5 years ago

我也遇见这个问题了, 提交不上去

linconz commented 5 years ago

我们删掉了这个属性,就可以提交上去了,但是上个月还是没有关系的

wangyanlong commented 5 years ago

目前我们的解决方案也是删掉这个属性, 前两天试过一回是可以的, 不知道为什么今天又不行了

kule123 commented 5 years ago

xcode10 不支持这个设置 xcode11 才支持

Xezun commented 4 years ago

胡说八道,谁说苹果强制支持dark模式了,人家只是建议,毕竟很多App根本没有必要dark模式,比如游戏。