如何捕获 iPhone VoiceOver 事件?
有什么方法可以捕获我的应用程序中的 [VoiceOver - ON/OFF] 事件?
我需要使我的菜单在两种情况下表现不同,使用画外音和正常方式。
Is there any way to catch the [VoiceOver - ON/OFF] event in my application?
I need to make my menu behave differently in two cases, using voiceover and normal way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果正在运行,则返回
BOOL
YES
。这是 iOS 4 及更高版本。This returns a
BOOL
YES
if it is running. This is iOS 4 and later.如果您需要它作为通知,
UIAccessibilityVoiceOverStatusChanged
(也是 4.0+)。If you need it as a notification,
UIAccessibilityVoiceOverStatusChanged
(also 4.0+).在应用委托的
applicationDidFinishLaunching:
方法中,订阅 VoiceOver 状态更改,如下所示:然后执行您需要执行的操作。在我的应用程序中,我在代码的 viewDidLoad 方法中设置了大量辅助功能代码,因此最简单的事情就是在 VoiceOver 更改时使应用程序崩溃并允许重新初始化所有内容:
In your app delegate's
applicationDidFinishLaunching:
method, subscribe to the VoiceOver status change like this:And then do whatever you need to do. In my app I have tons of accessibility code that is set up in the viewDidLoad methods of my code, so the easiest thing is to just crash the app on a VoiceOver change and allow everything to be re-initialized: