Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a UITableVIewCell without reloading full table [duplicate]

Possible Duplicate:
Is it possible to refresh a single UITableViewCell in a UITableView?

In a sequence I am updating only a particular object in my list data(NSMUtableArray), once updated its value, To make the GUI update, I was reloaded the full table like below...

[table reloadData];

It worked fine, However in efficiency point, it is hanging little bit while I am scrolling, Is there any way to update only a particular cell without reload full table?

thanks.

like image 944
Newbee Avatar asked Feb 05 '13 07:02

Newbee


3 Answers

 - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;

Use this

like image 105
amar Avatar answered Oct 12 '22 19:10

amar


You can use this..

NSArray *indexPathArray = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:0]];
//You can add one or more indexPath in this array...

[tblview reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationFade];
like image 24
Scorpian Alive Avatar answered Oct 12 '22 19:10

Scorpian Alive


You can get the cell object by -

UITableViewCell *cell = [table cellForRowAtIndexPath:indexPath];

now change its related values as per your object from data array. It should reflect in the table. Hope this helps.

like image 2
Nameet Avatar answered Oct 12 '22 20:10

Nameet