如何捕获 iPhone VoiceOver 事件?

发布于 2024-12-03 14:19:19 字数 88 浏览 2 评论 0原文

有什么方法可以捕获我的应用程序中的 [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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦幻的味道 2024-12-10 14:19:19
UIAccessibilityIsVoiceOverRunning()

如果正在运行,则返回 BOOL YES。这是 iOS 4 及更高版本。

UIAccessibilityIsVoiceOverRunning()

This returns a BOOL YES if it is running. This is iOS 4 and later.

与往事干杯 2024-12-10 14:19:19

如果您需要它作为通知,UIAccessibilityVoiceOverStatusChanged(也是 4.0+)。

If you need it as a notification, UIAccessibilityVoiceOverStatusChanged (also 4.0+).

九八野马 2024-12-10 14:19:19

在应用委托的 applicationDidFinishLaunching: 方法中,订阅 VoiceOver 状态更改,如下所示:

//  subscribing to VoiceOver change notification:
[[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(didChangeVoiceOverSetting:)
     name:UIAccessibilityVoiceOverStatusChanged
     object:nil];

然后执行您需要执行的操作。在我的应用程序中,我在代码的 viewDidLoad 方法中设置了大量辅助功能代码,因此最简单的事情就是在 VoiceOver 更改时使应用程序崩溃并允许重新初始化所有内容:

- (void)didChangeVoiceOverSetting:(NSNotification *)dictionary {
    // intentionally crashing the app if VoiceOver is changed
    assert(false);
}

In your app delegate's applicationDidFinishLaunching: method, subscribe to the VoiceOver status change like this:

//  subscribing to VoiceOver change notification:
[[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(didChangeVoiceOverSetting:)
     name:UIAccessibilityVoiceOverStatusChanged
     object:nil];

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:

- (void)didChangeVoiceOverSetting:(NSNotification *)dictionary {
    // intentionally crashing the app if VoiceOver is changed
    assert(false);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文