简体   繁体   中英

How to update a cell in a UITableView?

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

put your code in between:

[myTable beginUpdates];
//your code
[myTable setCell:newCell atIndex:i];
//your code end
[myTable endUpdates];

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 !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM