将顶部/底部视图添加到UITableViewController吗? [英] Add top/bottom views to UITableViewController?

查看:61
本文介绍了将顶部/底部视图添加到UITableViewController吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的情节提要中,我有具有自定义类的UITableViewController. 如何在表格视图的顶部和底部添加UIView对象?

In my storyboard I have UITableViewController which has custom class. How can I add UIView objects on top and bottom parts of the table view?

我必须在UIView中创建UITableView和两个所需的视图,然后手动初始化控制器,设置tableView还是有更好的方法?

Do I have to create UITableView and two desired views inside of UIView and then manually init my controller, set tableView or there is a better way?

推荐答案

如果您要使用UITableViewController来管理单元格和静态布局,则最好是在情节提要中使用容器视图.这将允许您在表周围布置主视图内容,并且仍然保留一个单独的UITableViewController来维护表本身.设置正确的自动布局约束(非常简单,只需将容器视图锚定到页眉和页脚视图即可)

If you're wanting to use UITableViewController for it's abilities to manage cells and static layouts, the best possibility would be to use a container view in your storyboard. This would allow you to layout the main view contents around the table and still keep a separate UITableViewController maintaining the table itself. Set up the right auto layout constraints (really simple, just anchor the container view to the header and footer views)

这篇关于将顶部/底部视图添加到UITableViewController吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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