有没有办法检测iPhone是否处于反色模式?

Com*_*ast 5 accessibility ios

您知道在可访问性方面,用户可以将主页按钮设置为三击并使其成为"反色模式"吗?您的应用有没有办法检测手机是否处于逆色模式?谢谢.

Dav*_*ist 8

是的,这很简单.你可以打电话

UIAccessibilityIsInvertColorsEnabled();
Run Code Online (Sandbox Code Playgroud)

返回a BOOL表示当前是否有反转颜色.

你也可以观察

UIAccessibilityInvertColorsStatusDidChangeNotification
Run Code Online (Sandbox Code Playgroud)

当用户打开或关闭反转颜色时收到通知.