如何在 iPhone 中使用 UITextView 时使键盘消失
我正在使用 UITextView,我对让键盘消失感到困惑。我是否需要使用某种通知来使其消失? 谢谢
I am using a UITextView and I am confused about making the keyboard to disappear. Do I need to use some kind of a notification to make it disappear.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是很直观,但您所要做的就是在视图控制器中实现
doneButtonOnKeyboardPressed
事件。实际上,您不必在事件处理程序中执行任何操作,只需处理它就会导致键盘在用户点击“完成”后消失。一个空的处理程序看起来像这样:
It's not very intuitive, but all you have to do is implement the
doneButtonOnKeyboardPressed
event in your view controller. You don't actually have to do anything inside of the event handler, just handling it will cause the keyboard to disappear after the user taps "Done".An empty handler will look something like this: