ios - UITableView viewForFooterInSection 仅在滚动后显示

标签 ios objective-c uitableview tableview footer

我有一个 UITableView 有一个部分和足够的行,tableView 需要滚动到底部。我想添加一个页脚 View ,它会粘在 tableView 的底部并且始终可见,所以我实现了 viewForFooterInSection。这是我的代码:

- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    NSLog(@"Get footer view");

    if (tableView == [self tableView]) {
        return [self footerRowRightView];
    }
    else if (tableView == [self fixedColumnTableView]) {
        return [self footerRowLeftView];
    }

    return nil;
}

我遇到的问题是页脚 View 仅在滚动 tableView 后显示,但我希望它从一开始就可见(即无论用户滚动与否始终 float )。

一旦 Controller 出现并且 tableView 加载其数据,我就会在日志中看到“获取页脚 View ”,所以我知道 viewForFooterInSection 正在被立即调用。我无法解决的是为什么它不会立即显示,以及如何让它这样做。

提前感谢您的帮助!

最佳答案

未正确返回页脚可能是您的高度。

检查您从 heightForFooterInSection 返回的内容

关于ios - UITableView viewForFooterInSection 仅在滚动后显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29014261/

相关文章:

ios - 将数据从初始 View Controller 传递到最后一个 View Controller

ios - 使用多个标签和开关处理 UITableViewCell 的可访问性

ios - 模糊效果 - 背景 UITextField

c# - 自定义控件绑定(bind)不起作用

ios - iOS 核心数据中的多个上下文

iphone - 无法为 subview 推送ViewController

iphone - 在 iPhone 的 UITableView 中自定义单元格选择样式的问题

ios - 多点连接有时不发送邀请

android - 在 UIManager 中找不到 React Native "RNCSafeAreaView"

objective-c - 解析 Graphviz 的 Dot 语言