本文介绍了如何告诉iOS 11中的Smart Invert不要反转我的app颜色并检测它是否已启用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 11有一个名为智能反转颜色的新功能,我想在我的应用中利用它。我已经在我的应用程序中实现了自己的黑暗模式,所以当启用Smart Invert时,我将自己进行颜色反转过程。我想知道的是:

iOS 11 has a new feature called "Smart Invert Colors", and I want to take advantage of that in my app. I already have my own dark mode implemented in my app, so I'll do the "color inversion" process myself when Smart Invert is enabled. What I want to know is:


  • 我如何告诉iOS 11应用程序有一个黑暗的界面并且不会反转颜色,类似iOS 10 +中的iOS时钟应用程序?

  • 如何启用哪种反转颜色,特别是智能反转或经典反转?

我已经在谷歌,StackOverflow和Apple开发者网站的各个地方搜索了一段时间,仍然无法找到答案。

I've searched everywhere at Google, StackOverflow, and Apple Developer Website for some time now and still couldn't find the answer.

提前致谢!

更新:

感谢,我成功地设法阻止iOS 11在我的应用中反转视图。现在我还有另一个问题......

Thanks to @Toma's answer, I successfully managed to prevent iOS 11 from inverting views in my app. Now I have another problem...

对于检测部分,似乎 UIAccessibilityIsInvertColorsEnabled()只会返回如果启用了Smart Invert,则 true (iOS 11)。至少对我来说这已经足够了。我现在想知道如何找出Classic Invert的开启时间。如果您知道如何操作,请在下面发布更新的答案!谢谢!

For the detection part, it appears that UIAccessibilityIsInvertColorsEnabled() will only return true if Smart Invert is on (iOS 11). At least it's enough for me, for now. I’m now wondering how to find out when Classic Invert is on. Post an updated answer below if you know how to do so! Thanks!

推荐答案

请参阅iOS 11 UIView 的属性。

See iOS 11 UIView's property accessibilityIgnoresInvertColors.

这篇关于如何告诉iOS 11中的Smart Invert不要反转我的app颜色并检测它是否已启用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 11:16