【发布时间】:2018-02-28 10:16:58
【问题描述】:
video of the tableview animation bug
我有一个表格视图,可以展开/折叠其单元格。
从 iOS 11 开始,tableView 在插入和删除行时开始出现奇怪的行为。 contentSize 在动画块发生之前发生了变化,因此,在视频中,您可以看到在折叠单元格上发生错误的回滚。动画看起来不对。
此代码在 iOS 10 上完美运行。有人知道 Apple 方面发生了什么变化吗?这是一个已知的问题?
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 swift uitableview ios11