1

我创建了一个UITableView使用Interface Builder我有一个节页脚空间,我将我的自定义视图设计为节页脚。但我希望最初隐藏部分页脚,并且仅在服务调用后加载它。

我努力了

self.tableview.tablefooterview.hidden = YES
self.tableview.sectionFooterHeight = 0.0f

我还在委托方法中设置了高度,但表格页脚视图根本没有隐藏。如何隐藏表格页脚视图。

4

4 回答 4

1

检查此链接以了解如何在 UITableView 中隐藏页脚视图

- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
{
    return [[UIView alloc] initWithFrame:CGRectZero];
}
于 2016-09-16T10:19:00.447 回答
0

请尝试将节页脚值设置为大于 0(零)。我尝试将其设置为 0.000001 并且它可以工作。

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

return 0.000001;
}
于 2016-09-16T08:26:13.900 回答
0

使用UITableView委托方法:-

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

    return 0;
}
于 2016-09-16T08:18:43.200 回答
-1

请尝试此代码

- (void)viewDidLoad
{
    self.tableview.sectionHeaderHeight = 0.0;
    self.tableview.sectionFooterHeight = 0.0;
    self.tableview.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
    self.tableview.tableFooterView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0;
}
于 2016-09-16T08:15:02.717 回答