Insert row without reload table

Hello, I have a tableview with many objects in it. If I want to add one row to it without reloading the whole table. Because there is some process in the cell. Can anybody help?

+8
ios objective-c iphone uitableview
source share
2 answers

You can do this in two ways -

[tableView beginUpdates]; [tableView insertRowsAtIndexPaths:newResults withRowAnimation:UITableViewRowAnimationNone]; [tableView endUpdates]; 

or

 [tableView insertRowsAtIndexPaths:newResults withRowAnimation:UITableViewRowAnimationNone]; 

here newResults are the NSArray of NSIndexPath you need to create. Then new lines are inserted (with or without some animation) into these lines.

+12
source share

Use below delegate method

 - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation 
+2
source share

All Articles