Interface builder (iOS 9+) (界面构建器(iOS 9+))
Just drag a UIView to the table. (只需将UIView拖到表中即可。) In storyboard, it will sit at the top below your custom cells. (在故事板中,它将位于自定义单元格下方的顶部。) You may prefer to name it "footer". (您可能更喜欢将其命名为“页脚”。)
Here it is shown in green for clarity, you'd probably want clear color. (为清晰起见,此处以绿色显示,您可能需要清晰的颜色。)
Note that by adjusting the height, you can affect how the "bottom bounce" of the table is handled, as you prefer. (请注意,通过调整高度,您可以根据需要影响表格的“底部反弹”处理方式。) (Height zero is usually fine). ((高度零通常很好)。)
To do it programmatically: (要以编程方式执行此操作:)
Swift (迅速)
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.tableFooterView = UIView()
}
Objective-C (Objective-C的)
iOS 6.1+ (iOS 6.1+)
- (void)viewDidLoad
{
[super viewDidLoad];
// This will remove extra separators from tableview
self.tableView.tableFooterView = [UIView new];
}
or if you prefer, (或者如果你愿意,)
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
Historically in iOS: (历史上在iOS中:)
Add to the table view controller... (添加到表视图控制器...)
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return CGFLOAT_MIN;
}
and if necessary... (如有必要......)
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
return [UIView new];
// If you are not using ARC:
// return [[UIView new] autorelease];
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…