iPhone:通过 XIB 完成按钮操作来放弃键盘
您好,我正在研究 UITextview
如何退出键盘,在键盘“完成按钮”后单击操作,XIB
谢谢
hi i am working on UITextview
how to Resign Keyboard, after keyboard "Done button" click Action, which XIB
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您好,如果您想回答,使用键盘上默认的“完成”按钮退出 UITextview 的键盘,那么这就是
我按照此退出 UITextview 键盘的答案,如果有任何问题,请告诉我,
谢谢
hi if you want answer for, Resign the keyboard of UITextview with default "Done" button on keyboard, then this is answer for that
i followed this to resign keyboard of UITextview, if there is any concern inform me
Thank You
创建一个
IBAction
并在 IB 中将其连接到UITextfield
的DidEndOnExit
事件。然后调用[textViewName resignFirstResponder]
让键盘消失。或者,尝试在 IBAction 中使用
[self.view endEditing:YES]
。Create an
IBAction
and in IB hook it up to theUITextfield
'sDidEndOnExit
event. Then call the[textViewName resignFirstResponder]
to make the keyboard go away.Alternatively, try using
[self.view endEditing:YES]
in the IBAction.要将操作分配给键盘的
Done
按钮:在这些示例中,
myTextView
是标头中定义的UITextView
并在 Interface Builder 中连接。要将其分配给外部按钮:
请务必在标头中定义一个
IBAction
,然后在 Interface Builder 中将按钮连接到的此操作touchUpInside:
.h
.m
To assign the action to the
Done
button of a keyboard:In these examples,
myTextView
is aUITextView
that is defined in the header and connected in Interface Builder.To assign it to an external button:
Be sure to define an
IBAction
in your header, then in Interface Builder, connect the button to this action fortouchUpInside:
.h
.m
在具有焦点的文本视图上调用
resignFirstResponder
以关闭键盘。Call
resignFirstResponder
on the textview that has focus in order to dismiss the keyboard.