Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark Mode #9

Open
ChenYilong opened this issue Jun 3, 2019 · 15 comments
Open

Dark Mode #9

ChenYilong opened this issue Jun 3, 2019 · 15 comments
Labels

Comments

@ChenYilong
Copy link
Owner

ChenYilong commented Jun 3, 2019

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可以设置,就是说明开发者有控制权。

@ChenYilong ChenYilong added the note label Jun 3, 2019
@ChenYilong ChenYilong changed the title dark mode Dark Mode Jun 4, 2019
@linconz
Copy link

linconz commented Jun 12, 2019

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

<key>UIUserInterfaceStyle</key>
<string>UIUserInterfaceStyleLight</string>

@ChenYilong
Copy link
Owner Author

@ChenYilong
Copy link
Owner Author

@xieweilyg
Copy link

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

@ChenYilong
Copy link
Owner Author

还没说必须

@linconz
Copy link

linconz commented Jul 9, 2019

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
Copy link
Owner Author

哈?没听懂,详细讲讲?

@linconz
Copy link

linconz commented Jul 10, 2019

哈?没听懂,详细讲讲?

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

@PhilCai1993
Copy link

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

@ChenYilong
Copy link
Owner Author

ChenYilong commented Aug 8, 2019

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

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

@wangyanlong
Copy link

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

@linconz
Copy link

linconz commented Aug 27, 2019

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

@wangyanlong
Copy link

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

@kule123
Copy link

kule123 commented Oct 8, 2019

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

@Xezun
Copy link

Xezun commented Nov 5, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants