Can I detect iOS' “darken colors” setting?

早过忘川 提交于 2019-12-03 22:59:19

问题


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?


回答1:


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.

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

-[UIImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]


来源:https://stackoverflow.com/questions/23919724/can-i-detect-ios-darken-colors-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!