문제

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:

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.

도움이 되었습니까?

해결책

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];
    });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top