使用键盘ios上下移动视图 [英] Move View up/down with Keyboard ios

查看:63
本文介绍了使用键盘ios上下移动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用类似于whatsapp等的聊天应用程序.它在视图控制器中具有表格视图,在底部工具栏中具有文本字段和按钮.我遇到了将视图向上滑动并使用此链接我设法将视图向上滑动.但是我想关闭键盘,视图下降并适合屏幕.我尝试使用点击手势并单击返回按钮,但似乎无济于事.如何使视图向下滑动并且键盘消失?

I am working on a chat application similar to whatsapp etc. It has a tableview in view controller and a text field and button in the bottom toolbar. I came across the various question on sliding the view upwards and using this link I managed to slide the view upwards. However I want to dismiss the keyboard and the view comes down and fits the screen .I tried using tap gesture and click on return button but nothing seems to work. How do I do make the view slide down and keyboard disappear?

此外,我如何更改文本字段的宽度,以便在用户编写邮件时出现多行?

Moreover how can i change the width of text field so that multiple lines can appear when the user is writing the message?

推荐答案

您可以将点击手势事件添加到表格视图单元格中,也可以在用户单击表格视图时使用触摸事件方法,然后根据键盘的先前状态显示或隐藏键盘.希望这对你有帮助.

you can add tap gesture event to tableview cell and also you can use touch event method when user click on tableview then according to keyboard previous state you can display or hide keyboard. Hope this will help to u.

这篇关于使用键盘ios上下移动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆