简体   繁体   English

如何为作为UITableView的页脚放置的UIView设置固定高度?

[英]How do I set a fixed height for a UIView placed as the footer of a UITableView?

I haven't been able to change the height of the view. 我无法更改视图的高度。 I've tried changing it's .bounds , .frame , and height field in the size inspector. 我试图改变它的.bounds.frame ,并在尺寸检查高度场。 As it is, the view has a height larger than what I've set in IB. 实际上,该视图的高度大于我在IB中设置的高度。 When I go to debug the view hierarchy, the UIView's height goes beyond the wrapper views for the table view and gives me excess that I'd like to trim. 当我去调试视图层次结构时,UIView的高度超出了表视图的包装器视图,并给了我一些多余的东西。

How I've added the view to the tableview . 我如何将视图添加到tableview中 I assume this means the UIView is the now the footer of UITableView! 我认为这意味着UIView现在是UITableView的页脚!

How far the UIView has extended the height .The blue you see at the top is the bottom edge of the last cell in the table. UIView扩展了高度 。您在顶部看到的蓝色是表格中最后一个单元格的底部边缘。 All the grey is excess space from the UIView. 所有灰色是UIView中的多余空间。

I assume this means the UIView is the now the footer of UITableView! 我认为这意味着UIView现在是UITableView的页脚!

Nope, this is wrong. 不,这是错误的。 Looks like you just added a view as a subview of your table view. 看起来您刚刚将视图添加为表格视图的子视图。 You need to set your table view's tableFooterView property . 您需要设置表格视图的tableFooterView属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM