强制页脚留在表格视图中的最后一个单元格下方

Forcing footer to stay under last cell in tableview

我有一个带有自定义单元格的 table 视图。我想要的是在 table 视图的底部有一个页脚(如 "loading" 指示器”)。我正在使用此代码添加页脚:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [spinner startAnimating];
    spinner.frame = CGRectMake(0, 0, 320, 44);

    return spinner;
}

但这会使页脚 "float" 位于 table 视图的底部并与 table 的底部重叠:

如何强制页脚仅在 table 的最后一个单元格下方可见?像这样:

谢谢!

我认为您应该设置 tableFooterView 而不是设置节页脚视图。

您可以通过将 UIView 拖到 UITableView 中并在其中放置加载指示器来在故事板中执行此操作。 从您的文档大纲看起来应该与此类似