最佳答案
界面生成器(iOS 9+)
只需将一个 UIView 拖到表格中即可。在 Storyboard 中,它将位于自定义单元格下方的顶部。您可能更愿意将其命名为“页脚”。
这里为了清晰起见以绿色显示,您可能需要清晰的颜色。
请注意,通过调整高度,您可以随心所欲地影响表格“底部反弹”的处理方式。 (高度为零通常没问题)。
以编程方式执行此操作:
swift
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.tableFooterView = UIView()
}
objective-C
iOS 6.1+
- (void)viewDidLoad
{
[super viewDidLoad];
// This will remove extra separators from tableview
self.tableView.tableFooterView = [UIView new];
}
或者如果你愿意,
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
iOS 历史上:
添加到 TableView Controller ...
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return CGFLOAT_MIN;
}
如果有必要...
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
return [UIView new];
// If you are not using ARC:
// return [[UIView new] autorelease];
}
关于ios - 消除 UITableView 下面多余的分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1369831/