Open serhiikrivtsov opened 8 years ago
Got the same problem. But how do you check if the child is visible or not? My code:
if let visible = treeView.itemsForVisibleRows {
if visible.filter({ el in el == item.value }).count > 0 {
treeView.reloadRows(forItems: [item.value], with: RATreeViewRowAnimationFade)
}
}
In the current implementation of method reloadRowsForItems:withRowAnimation:
When we call it for child item of collapsed parent in the line
NSIndexPath *indexPath = [self indexPathForItem:item]
we receive incorrect indexPath. As result, in the cases when this incorrect indexPath is out of range for tableView (it happens when index of row for child to reload, when it's parent expanded, bigger then number of rows in tableView, when it's parent collapsed) , we get such exception:To avoid this situation, before reloading such children (children which parents could be collapsed on moment of reloading) i check if cells for this items are visible, using this method of treeView cellForItem: which returns nil if cell for given item is not visible. And the question is: Do i need to do this check or you should implement this internally?