ios - 执行 "beginUpdates" "endUpdates"时 UITableView 页脚 View 的动画问题

标签 ios uitableview animation footer

当我使用动画(使用 beginUpdates()、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()
}

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

最佳答案

我遇到了完全相同的问题(页脚移动到表格 View 的底部并停留在那里)。 看起来这是一个 iOS8 错误(在 iOS7 上不会发生)。

在我的例子中,解决方法是将页脚作为下一个节的标题返回...

关于ios - 执行 "beginUpdates" "endUpdates"时 UITableView 页脚 View 的动画问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26254125/

相关文章:

ios - 程序收到信号 : “EXC_BAD_ACCESS” with Core Data

html - CSS 动画无法正常工作

javascript - Skrollr 在 chrome 中相对自上而下很早就火了

ios - 为 CocoaPods 的 pod 设置部署目标

ios - 用于移动应用程序的 PhoneGap 和 jQuery Mobile 页面之间的白色闪光

iphone - DigitalDJ/AudioStreamer 未连接到流媒体服务器

ios - 从 UITableView 中删除表头后,还有一个空隙

ios - 使用 UITableViewAutomaticDimension 重新加载 tableview,弹跳

ios - 创建 CGRect 作为关联对象?

design-patterns - 什么是复杂动画的好的抽象?