当我设置一个有4行的表格视图时,在填充行的下面仍然有额外的分隔行(或额外的空白单元格)。
如何移除这些单元格?
当我设置一个有4行的表格视图时,在填充行的下面仍然有额外的分隔行(或额外的空白单元格)。
如何移除这些单元格?
当前回答
改进J. Costa的解决方案:你可以通过下面这行代码对表进行全局更改:
[[UITableView appearance] setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
在第一个可能的方法中(通常在AppDelegate中,在:application:didFinishLaunchingWithOptions: method)。
其他回答
如果你想移除UITableview中不需要的空间,你可以使用下面两个方法
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.1;
}
迅速:
override func viewDidLoad() {
super.viewDidLoad()
tableView.tableFooterView = UIView()
}
我只是在ViewDidLoad函数中添加了这一行,问题就解决了。
tableView.tableFooterView = [[UIView alloc] init];
iOS 7+使用故事板
简单地拖一个UIView到你的UITableView作为页脚。设置页脚视图的高度为0。
试试这个
self.tables.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 10.0f)];