正如您在此处看到的,我只有 2 个数据用于测试,它们已加载到 TableView 中。这很好。但是,还有很多空单元格也被自动生成了。
如何使这些空单元格不可见?
最佳答案
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];
关于IOS Dev - 如何使那些空的表格单元格不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24060974/