![](/img/trans.png)
[英]iPhone keyboard wont show up after adding uitextfield.inputView
[英]How to show keyboard after used inputView
我使用inputView
为我的textfield
显示uipickerview
,但我对其他函数使用相同的textfield
。 在将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];
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.