scottliyq scottliyq - 19 days ago 6
iOS Question

How to refresh a UITableView in iphone?

I have a UI table view loading data from network. If the user move the finger on one cell, one button will be displayed, just like iPhone style delete button. If the user click this button, the value of one label in the cell will be changed accordingly. However, I didn't find any way to make table view to re-draw this cell, except for reload the whole table. I don't want to use reload data method, because I just need change the value in one cell instead of the whole table. Any suggestion on this?

Answer

Take a look at the method

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

Calling this method will result in your table view's data source asking its delegate for information about that cell.

For future reference, I found this very easily by checking the documentation on UITableView. I suggest you do that in the future before posting here.