Can I detect iOS' “darken colors” setting?

2020-03-07 11:01发布

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条回答
放荡不羁爱自由
2楼-- · 2020-03-07 11:07

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]
查看更多
登录 后发表回答