3

我有一个自定义 tableFooterView(它只是一个带有渐变的 8px 高 CoreGraphics 弧),我使用 viewDidLoad 中的 tableFooterView 属性而不是 viewForFooterInSection 设置。当用 viewForFooterInSection 设置它时,它在到达底部时漂浮在内容上,而 tableFooterView 做了我想要的,因为它保持 UITableView 的高度。

但是当单元格或表格视图的高度确实发生变化时,tableFooterView 会缓慢地为它们设置动画(大约半秒,但非常明显)。这很尴尬,因为页脚应该看起来像最后一个单元格的扩展。例如,当 heightForRowAtIndexPath 更改单元格的高度时,tableFooterView 就会像幽灵一样飘回来。在此屏幕截图中,底部单元格刚刚缩小到正常大小,页脚向后浮动。

(作为新用户,我无法发布图片,但链接如下:http ://desmond.imageshack.us/Himg835/scaled.php?server=835&filename=iossimulatorscreenshotj.png&res=landing )

(此内容不再可用,2015 年 9 月 14 日)。

当最后一个单元格的高度突然变大时,它也会漂浮在内容上。

任何指针?非常感谢。

编辑:通过高度变化的单元格,我的意思是通过 heightForRowAtIndexPath 部分:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    Note *currentNote = [self.notes objectAtIndex:indexPath.row];
    if (currentNote.associatedCellIsSelected) {
        return NORMAL_CELL_FINISHING_HEIGHT*2;
    }

    return NORMAL_CELL_FINISHING_HEIGHT;
}

编辑 2:在 didSelectRowAtIndexPath 中,我选择了单元格(实际上是单元格的注释),开始/结束更新以及为已选择的行调用 reloadRow。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

Note *currentNote = [self.notes objectAtIndex:indexPath.row];

if (currentNote.associatedCellIsSelected == FALSE) {
    currentNote.associatedCellIsSelected = TRUE;
    [tableView beginUpdates];
    [tableView endUpdates];
}

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];    }

我还确保使用纯 rect redColor UIView 代替 Core Graphics 页脚获得相同的行为,并获得相同的结果。我希望有一种简单的方法来覆盖页脚并告诉它不要动画!

4

0 回答 0