如何在使用inputView后显示键盘

我使用inputView为我的textfield显示uipickerview ,但我使用相同的textfield用于其他function。 在将inputView用于该textfield后,如何显示标准键盘?

 textfield.inputView = pickrView; 

只是

textfield.inputView = nil;

为我工作

正如Pavel Kaljunen所说,你只需要将inputView设置为nil,但是当键盘已经可见时,你必须首先使用resignFirstResponder,将inputView设置为nil然后再次设置为FirstResponder。

 [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.35]; [yourTextField resignFirstResponder]; yourTextField.inputView = nil; [yourTextField becomeFirstResponder]; [UIView commitAnimations]; 

我认为这段代码可能有用

  [textField.inputView addTarget:self action:@selector(doTest) forControlEvents:UIControlEventTouchUpInside]; - (void)doTest { if([textFiled isFirstResponder]) { [textFiled resignFirstResponder]; } else { [textFiled becomeFirstResponder]; } }