iOS 11 UITableView删除行动画bug [英] iOS 11 UITableView delete rows animation bug

查看:429
本文介绍了iOS 11 UITableView删除行动画bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看tableview动画错误的视频

我有一个扩展/折叠其单元格的表格视图。

I have a table view which expands/collapse its cells.

从iOS 11开始,tableView在插入和删除行时开始表现奇怪。
在动画块发生之前,contentSize已经更改,因此,在视频中,您可以看到在折叠单元格上发生错误回滚。动画看起来不错。

As of iOS 11, the tableView starts to behave strangely on insertion and deletion of rows. The contentSize has changed before the animation block happens and consequently, in the video, you can see a buggy scroll back happening on collapsing cells. The animation just looks wrong.

这段代码在iOS 10上完美运行。有人知道Apple方面有什么变化吗?这是一个已知的问题?

This code worked perfectly on iOS 10. Do anyone know what has changed on Apple's side? Is this a known issue?

public func insertingRowsForAccordion(_ indexArray: [IndexPath], selectedRowIndex: Int) {
    beginUpdates()
    insertRows(at: indexArray, with: UITableViewRowAnimation.fade)
    endUpdates()

 // Scroll to selection after expanding children
    scrollToRow(at: IndexPath(row: selectedRowIndex, section: 0), at: UITableViewScrollPosition.top, animated: true)
}

public func removeRowsForAccordion(_ indexArray: [IndexPath]) {
    beginUpdates()
    deleteRows(at: indexArray, with: UITableViewRowAnimation.fade)
    endUpdates()
}


推荐答案

我在iOS 11中遇到了无数问题 UITableView 。在我的整个应用程序中找到每个 UITableView 并执行以下操作修复了我的所有问题。

I have been having countless problems with iOS 11 UITableView. Going to every UITableView in my entire app and doing the following fixed all of my problems.

设置 estimatedRowHeight estimatedSectionHeaderHeight estimatedSectionFooterHeight 为0。

来源: iOS 11 Floating TableView Header

这篇关于iOS 11 UITableView删除行动画bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆