Includes a completion block. Who doesn't like a block?
@interface DUTableView : UITableView - (void) reloadDataWithCompletion:( void (^) (void) )completionBlock; @end
and...
#import "DUTableView.h" @implementation DUTableView - (void) reloadDataWithCompletion:( void (^) (void) )completionBlock { [super reloadData]; if(completionBlock) { completionBlock(); } } @end
Using:
[self.tableView reloadDataWithCompletion:^{
EDIT:
Please note that the top half is the solution. The number of sections and rows and row heights are synchronously updated in the main thread, so using the above code, the termination will call back when part of the user interface has been completed. But loading data from a data source is asynchronous - so really this answer is not quite what @Michal wanted.
source share