Ios 执行“时,UITableView页脚视图出现动画问题”;“开始更新”&引用;endUpdates";

Ios 执行“时,UITableView页脚视图出现动画问题”;“开始更新”&引用;endUpdates";,ios,uitableview,animation,footer,Ios,Uitableview,Animation,Footer,当我用动画(使用BeginUpdate(),endUpdates())更改单元格高度时,我的节页脚有一个非常奇怪的动画:它在tableview的底部移动 这是我能写的最简单的代码 func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { return "footer" } func tableView(tableView: UITableView, heigh

当我用动画(使用BeginUpdate(),endUpdates())更改单元格高度时,我的节页脚有一个非常奇怪的动画:它在tableview的底部移动

这是我能写的最简单的代码

func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? {
    return "footer"
}

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return cellHeight
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    return tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    tableView.beginUpdates()
    cellHeight += 20;
    tableView.endUpdates()
}

我怎样才能避免这个动画问题呢?

我遇到了完全相同的问题(页脚移动到tableview的底部并保持在那里)。 它看起来像是一个iOS8错误(它不会发生在iOS7上)


在我的例子中,一种解决方法是将页脚作为下一节的页眉返回…

我想知道这段代码是如何工作的。你说的
cellHeight+=20是什么意思?它是停留在底部还是只是一种暂时状态?看看这篇文章