将UITableView嵌入为UIViewController中的容器视图 [英] Embedding a UITableView as a container view within a UIViewController

查看:50
本文介绍了将UITableView嵌入为UIViewController中的容器视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个文本字段并发送按钮,该按钮粘贴在uitableview的底部,类似于聊天应用程序.我曾在将UITableView作为容器视图嵌入UIViewController时遇到过评论.

I would like to add a textfield and send button that sticks to the bottom of uitableview similar to a chat app. I have come across comments on embedding a UITableView as a container view within a UIViewController.

但是,他们似乎缺少实现此目标的示例.更具体地讲,包括在键盘出现时在何处添加文本字段/按钮以及向上移动文本字段等详细信息.谢谢!

However, they seem to lack an example on how to achieve this. More specifically details including where to add a textfield/button and move textfield up when keyboard appears, etc. Thanks!

推荐答案

使用情节提要按照步骤进行操作

follow the steps using the storyboard

1) drag a uiviewcontroller from the object library.
2) drag and drop the textfield and button and place it at the position you want
3) drag and drop a container view.
4) delete the default uiviewcontroller comes with the container view
5) drag a uitableviewcontroller and make a segue and the segue should be embedsegue.

对于键盘处理,您可以使用 IQKeyboardManager https://github.com/hackiftekhar/IQKeyboardManager

and for keyboard handling you can go with IQKeyboardManager library https://github.com/hackiftekhar/IQKeyboardManager

这篇关于将UITableView嵌入为UIViewController中的容器视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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