I am developing an iOS application with a view containing a TableView. Some method receives data from the Internet, opens a new stream for calculating information, and inserts a row into the table at run time using the method: insertRowsAtIndexPaths .
Now, if a lot of data arrives at once, the table can be updated after several inserts, and not after each of them, and this raises an exception saying that the number of rows in the section is incorrect (this is because it thinks that it should have an increase of one row, but streams already inserted an array of data a few more cells).
Even if I do an insert lock on the data array and the insertRowsAtIndexPaths method, it still does the same thing.
NSLock *mylock = [[NSLock alloc] init]; [mylock lock]; [array addObject:object]; [tableView insertRowsAtIndexPaths:indexPath withRowAnimation:UITableViewRowAnimationLeft]; [mylock unlock];
help me please,
Thanks!
source share