iOS上UITableView. reloadData时出现闪,试了网上各种方法都不行,包括UIView.performWithoutAnimation....,包括设置rowHeight等等。
最后自己通过以下方法解决:
在添加数据时,一并加上以下代码:
self.feedTableView.insertRow(at: IndexPath(row: self.datasource.count-1, section: 0), with: .none)
self.feedTableView.reloadRow(at: IndexPath(row: self.datasource.count-1, section: 0), with: .none)
这样,不用调用reloadData,数据和界面也可以更新。