ios - UITableView 底部分隔符插图 - IOS 7 中的奇怪行为

标签 ios objective-c uitableview ios7 uikit

我的应用包含一个 UITableView,它有部分页脚。当用户滚动到 tableView 的底部时,有时最后一个单元格和 tableFooter 之间会出现分隔符插图。这种行为是不一致的。

enter image description here

enter image description here

有没有办法强制这个分隔符总是出现或从不出现?你们中有人注意到同样的不一致行为吗?对我来说似乎是个错误。

编辑
我正在使用

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UILabel *footer = [[UILabel alloc] init];

    footer.backgroundColor = [UIColor whiteColor];

    footer.font = [footer.font fontWithSize:15];
    footer.textAlignment = NSTextAlignmentCenter;

    return footer;
}

但你可以很容易地重现同样的问题只使用

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;

enter image description here

enter image description here

最佳答案

为此,您必须覆盖用作页脚的标准 UIView

您可以通过覆盖委托(delegate)方法 -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 来做到这一点。

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *myFooterView;

    // create a view with a label and without a line at the top etc...

    return myFooterView;
}

关于ios - UITableView 底部分隔符插图 - IOS 7 中的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22612570/

相关文章:

ios - tableview controller、嵌入式 tableview 或其他用于此界面的东西?

swift - tableview.reloadData() 不重复 cellForRowAt 函数

objective-c - 使用 RestKit 在 NSDictionary 中嵌套对象

ios - 如何使用 Interface Builder 设置链接到另一个窗口的 UITableView

ios - for 语句循环未按预期工作

ios - MonoTouch UIImage.FromFile 不加载视网膜 Assets

python - 有没有办法用 python 开发 OS X 应用程序?

objective-c - 垃圾收集吃掉状态项

ios - 如何在 objective-c 中的 View Controller 上获取自定义TableViewCell值

IOS 在流式传输视频时检测调用中断