【发布时间】:2014-07-26 11:49:35
【问题描述】:
正如您在此处看到的,我只有 2 个数据用于测试,它们已加载到表视图中。这很好。但是,还有很多空单元格也被自动生成了。
如何让这些空单元格不可见?
【问题讨论】:
标签: ios objective-c uitableview
正如您在此处看到的,我只有 2 个数据用于测试,它们已加载到表视图中。这很好。但是,还有很多空单元格也被自动生成了。
如何让这些空单元格不可见?
【问题讨论】:
标签: ios objective-c uitableview
yourtableViewname.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
或
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}
对于 iOS 7
self.yourtableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
【讨论】:
这应该可行:
self.tableView.separatorColor = [UIColor clearColor];
self.tableView.backgroundColor = [UIColor clearColor];
【讨论】:
您可以在加载视图时降低 tableview 的整体高度。根据总单元格高度计算表格视图的高度。将表格高度最大值分配给屏幕高度。
【讨论】: