iOS 11 UITableView删除行animation错误
tableviewanimationbug的video
我有一个表格视图,展开/折叠其单元格。
从iOS 11开始,在插入和删除行时,tableView开始performanceexception。 在animation块发生之前,contentSize已经改变,因此在video中,可以看到折叠单元格上发生错误的回滚。 animation只是看起来不对。
这段代码在iOS 10上完美运行。有谁知道苹果方面有什么变化吗? 这是一个已知的问题?
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
,并执行以下操作,解决了我所有的问题。
设置estimatedRowHeight
, estimatedSectionHeaderHeight
estimatedRowHeight
, estimatedSectionHeaderHeight
estimatedSectionFooterHeight
为0。
来源: iOS 11浮动TableView标头