0

I'm using Delegate methods to get data from child view and want to dynamically edit my table in the root view.

So I would like to do something like this in my viewWillAppear method :

[myTable setCell:newCell atIndex:i];

What should I do ? Thanks a lot

Rob
  • 15,732
  • 22
  • 69
  • 107
  • possible duplicate of [Is it possible to refresh a single UITableViewCell in a UITableView?](http://stackoverflow.com/questions/4448321/is-it-possible-to-refresh-a-single-uitableviewcell-in-a-uitableview) – jscs May 26 '12 at 18:12

2 Answers2

0

put your code in between:

[myTable beginUpdates];
//your code
[myTable setCell:newCell atIndex:i];
//your code end
[myTable endUpdates];
Saurabh Passolia
  • 8,099
  • 1
  • 26
  • 41
  • No I was meaning, is there a way to update my cell looking like this function ? – Rob May 26 '12 at 18:51
0

Well, finally I made it using :

[cellules beginUpdates];
[cellules reloadData];
[cellules endUpdates];

I used reloadData because it's a little TableView (3 cells), for big TableViews this should be better :

– reloadRowsAtIndexPaths:withRowAnimation:

Thanks anyway !

Rob
  • 15,732
  • 22
  • 69
  • 107
  • Glad you figured it out! If the cell is visible, you can also call `cellForRowAtIndexPath:` on the table view and then modify the properties or contents of that cell -- you might notice that some of the Xcode project templates use this approach. – rickster May 27 '12 at 20:30
  • Yep, I used reloadData because I've a small Table View (only 3 cells), but of course I should use cellForRowAtIndexPath. Thanks ! – Rob May 27 '12 at 20:46