insertRowsAtIndexPaths: withRowAnimation: example

    NSMutableArray* insertingRows = [NSMutableArray array];
for (int i = 1; i <= _model.items.count; i++) {
        NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:_indexPath.row + i inSection:_indexPath.section];
        [insertingRows addObject:newIndexPath];
  [self.tableView beginUpdates];
    [self.tableView insertRowsAtIndexPaths:insertingRows withRowAnimation:UITableViewRowAnimationAutomatic];;
[self.tableView endUpdates];

    // ensure the expanded section visible

    if (header.showAsExpanded && [rowsOfSection count] > 0)
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:sectionIndex] atScrollPosition:UITableViewScrollPositionTop animated:YES];         });

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s