RATreeView
RATreeView copied to clipboard
Question?
I have a data source that is changing the tree in background, I need to know when the cellForItem loop has started and when it is done to I can prevent a display update. If I had access to the numberOfRowsInSection which appears to be call at the start of a refresh that might help.
Ideally some kind of notification will the tree building is in progress would help.
any thoughts?
Thank you and Great code
Hey,
Unfortunately, I don't think there is a way to achieve what you want by using only the public interface of the RATreeView. Even more - I don't think that there is a reliable way to check whether cellForItem loop finishes.
I think that in order to achieve that you have to keep additional state on your side which keeps information about whether you or the user did something that can lead to the changes in the hierarchy of the RATreeView. You can do that by:
- Implementing treeView:willExpandRowForItem,
treeView:didExpandRowForItem:, 'treeView:willExpandRowForItem:' andtreeView:didExpandRowForItem:methods that inform you whenRATreeViewchanges because of the user interactions. - Keeping state that informs about changes to the
RATreeViewstarted by availableRATreeViewmodification methods. You can useCATransactionAPI in order to be informed about whenRATreeViewupdates finish.
[CATransaction begin];
[CATransaction setCompletionBlock:^{
//This block will be called when modifications finish
}];
//You can put RATreeView modification methods here. For example:
//[self.treeView expandRowForItem:item];
[CATransaction end];
I hope that this answers your question.