UITableView insertRowsAtIndexPaths:WithRowAnimation without freeze UI

I try to understand what is the best practice to use when I work with UITableView with large number of row to insert when the table is visible.

This is my behavior:

  • Change the color of a link in an NSMutableAttributedString
  • Set UIButton title UILabel font size programmatically
  • Write extend file attributes swift example
  • How to present a splash/login view controller using storyboards
  • UIImagePickerController crash only on iOS 7 - iPad
  • How to add a custom separator to UITableViewCell?
  • I have one UITableView and one Thread that try to insert a data into this table. I think that make a [UITableView reloadData] is a poor solution for the performance aspect, and I know that UIKit operation are be carried on main thread, for this reason when the datasource update is completed I tried to send a NSNotification to make a UITableView update operation (beginUpdate – insertRowAtIndex – endUpdate) on the main thread, but this technique freeze the user interface. I have to work with 1000+ number of rows.

    Someone has already solved this problem ? Is it a possible solution the use of GDC async and sync? If yes, how?
    Thanks in advance.

    Solutions Collect From Internet About “UITableView insertRowsAtIndexPaths:WithRowAnimation without freeze UI”

    Do you try like this:

    dispatch_async(dispatch_get_main_queue(), ^{
            [self.tableView beginUpdates];
            [self.tableDatalist insertObject:obj atIndex:index];
    
            [self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:index inSection:0]]
                                  withRowAnimation:UITableViewRowAnimationRight];
            [self.tableView endUpdates];
        });