识别iOS-Keyboards VoiceOver状态

时间:2015-11-17 11:54:35

标签: ios objective-c notifications voiceover

我想在我的ViewController中识别,我的TextView的InputMode更改为Dictation。

此代码一直有效,直到iOS 7。

// In viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleCurrentInputModeDidChange:) name:UITextInputCurrentInputModeDidChangeNotification object:nil];

// a method of the controller
- (void)handleCurrentInputModeDidChange:(NSNotification *)notification
{
    UITextInputMode *mode = [notification object];

    NSString *primaryLanguage = [mode primaryLanguage];

    if ([primaryLanguage isEqualToString:@"dictation"]) {

        if ([[self delegate] respondsToSelector:@selector(notizControllerStartedVoiceRecognition:)]) {

            [[self delegate] notizControllerStartedVoiceRecognition:self];
        }

        [self setWasVoiceInput:YES];
    }
}

现在在iOS 8和9上,我们在代码中为模式变量获得“nil”。

任何人都可以解释一下,如何重新开始工作?

0 个答案:

没有答案