Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert row without reloading table

Hello i have tableview with many objects in it. If i want to add one row in it without reloading whole table. Because there are some process in cell. Anybody can help ?

like image 206
user1072740 Avatar asked Dec 28 '11 11:12

user1072740


2 Answers

You can do it in 2 ways -

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

or

[tableView insertRowsAtIndexPaths:newResults withRowAnimation:UITableViewRowAnimationNone];

here newResults are an NSArray of NSIndexPath which you need to create. Then the new rows are inserted (with some animation or without) at those rows.

like image 134
Srikar Appalaraju Avatar answered Sep 25 '22 11:09

Srikar Appalaraju


Use below delegate method

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
like image 29
Narayana Avatar answered Sep 23 '22 11:09

Narayana