只需将一个UI视图拖到表中即可.在故事板中,它将位于自定义单元格的顶部.您可能更喜欢将其命名为"Footer".
为了清晰起见,这里用绿色显示,您可能想要清晰的 colored颜色 .
请注意,通过调整高度,您可以根据自己的喜好影响如何处理桌子的"底部反弹".(高度为零通常可以).
要以编程方式执行此操作,请执行以下操作:
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.tableFooterView = UIView()
}
- (void)viewDidLoad
{
[super viewDidLoad];
// This will remove extra separators from tableview
self.tableView.tableFooterView = [UIView new];
}
或者如果你愿意,
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
添加到表视图控制器.
- (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];
}