如何在 UIView 完成后保留键盘并关闭
我有 UIView 和几个 UITextFields。加载时,我调用 [textfield comeFirstResponder] 将键盘显示在屏幕上。在完成视图之前我不想关闭这个键盘。
当我“触摸”任何文本字段之外时,键盘消失。
我尝试设置
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
return NO;
}
,但是即使卸载后我也无法关闭键盘。 有什么提示如何始终保留键盘并在 uiview 删除之前将其关闭吗?
I have UIView with few UITextFields. On load I call [textfield becomeFirstResponder] to bring keyboard on the screen. I don't want to dismiss this keyboard until I done with view.
Keyboard dissapear after I "touch" outside any textfield.
I tried to set
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
return NO;
}
however then I can't dismiss keyboard even after is unloaded.
Any hints how to keep keyboard all the time and dissmiss it just before uiview remove?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当调用
viewWillDisappear
(或viewDidDisappear
)时,请在UITextField
上调用resignFirstResponder
。When
viewWillDisappear
(orviewDidDisappear
) is called, then callresignFirstResponder
on yourUITextField
.在解雇前拨打此电话线。
call this line before dismiss.