我可以检测到iOS'“变暗的颜色”吗?设置? [英] Can I detect iOS' "darken colors" setting?

查看:88
本文介绍了我可以检测到iOS'“变暗的颜色”吗?设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当启用变暗颜色iOS系统设置时,我的应用程序看起来不太好。有些导航按钮是白色的,有些则变暗为灰色。

I noticed that my app doesn't look good when the "darken colors" iOS system setting is enabled. Some navigation buttons are white, some are darkened to gray.

有没有办法检测此设置是否已启用?

Is there any way to detect if this setting is enabled?

推荐答案

原来它很容易被发现。假设navigationBar配置了白色 tintColor 。只需阅读 navigationBar.tintColor 即可返回调整后的颜色,在本例中为80%白色。我们可以使用这种颜色设置 navigationBar.titleTextAttributes

Turns out it's quite easy to detect. Suppose the navigationBar is configured with a white tintColor. Just reading navigationBar.tintColor returns the adjusted color, in this case 80% white. We can use this color to set the navigationBar.titleTextAttributes.

对于所有可着色元素,如UIBarButtonItems,请确保仅使用模板图像:

For all tintable elements such as UIBarButtonItems, make sure to use template images only:

-[UIImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]

这篇关于我可以检测到iOS'“变暗的颜色”吗?设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆