Objective c iOS 9键盘快捷键禁用问题

Objective c iOS 9键盘快捷键禁用问题,objective-c,keyboard-shortcuts,ios9,Objective C,Keyboard Shortcuts,Ios9,我正在尝试使用下面的代码禁用键盘快捷键和预测文本 -(void)textFieldDidBeginEditing:(UITextField *)textField{ textField.inputAssistantItem.leadingBarButtonGroups = @[]; textField.inputAssistantItem.trailingBarButtonGroups = @[]; [textField setAutocorrectionType:UIT

我正在尝试使用下面的代码禁用键盘快捷键和预测文本

-(void)textFieldDidBeginEditing:(UITextField *)textField{
    textField.inputAssistantItem.leadingBarButtonGroups = @[];
    textField.inputAssistantItem.trailingBarButtonGroups = @[];
    [textField setAutocorrectionType:UITextAutocorrectionTypeNo];
}
我使用返回键作为切换文本字段的下一个按钮,代码如下

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
if (textField == _first) {
        [_second becomeFirstResponder];
}else if (textField == _second){
        [_third becomeFirstResponder];
}else{
        [textField resignFirstResponder];
}
return YES;
}
但在切换到第二个文本字段时,键盘会闪烁。在分析之后,我发现UIKeyboardDidShowNotification被多次调用


请帮帮我。

从文档中回复:
textfield的返回值应该返回

如果文本字段应实现其默认行为,则为“是” 返回按钮;否则,不会

此外:

每当用户点击返回键时,文本字段就会调用此方法 按钮在以下情况下,可以使用此方法实现任何自定义行为: 按钮被点击了


因此,您应该返回
NO
,而不是
YES
,因为您不希望实现默认的
return
行为。

感谢您的努力,它不起作用,我也尝试过。我在第一个和第二个按钮中插入了return NO,在最后一个按钮中插入了return YES。