如何在 iPhone 中使用 UITextView 时使键盘消失

发布于 2024-08-02 20:40:34 字数 56 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界和平 2024-08-09 20:40:34

这不是很直观,但您所要做的就是在视图控制器中实现 doneButtonOnKeyboardPressed 事件。实际上,您不必在事件处理程序中执行任何操作,只需处理它就会导致键盘在用户点击“完成”后消失。

一个空的处理程序看起来像这样:

- (IBAction) doneButtonOnKeyboardPressed:(id)sender {  
} 

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:

- (IBAction) doneButtonOnKeyboardPressed:(id)sender {  
} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文