2

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.

4

3 回答 3

1
UIAccessibilityIsVoiceOverRunning()

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

于 2011-09-06T03:08:25.370 回答
1

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

于 2011-09-27T17:04:17.833 回答
0

在您的应用委托的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);
}
于 2013-04-05T19:46:18.953 回答