Reputation: 4223
Which method should I use in order to display a cell again in a UITableViewController
?
Upvotes: 0
Views: 321
Reputation: 125510
If you want to reload specific cells, use UITableView
's reloadRowsAtIndexPaths:withRowAnimation:
method. For example, if you want to reload the cell at row 20 in section 0 and the cell at row 4 in section 2 without an animation:
[cell reloadRowsAtIndexPaths:[NSArray arrayWithObjects:
[NSIndexPath indexPathForRow:20 inSection:0],
[NSIndexPath indexPathForRow:4 inSection:2],
nil]
withRowAnimation:UITableViewRowAnimationNone];
If you want to reload all the cells in the table view, then use UITableView
's reloadData
method (but be aware of the performance implications):
[tableView reloadData];
Alternatively, if you just want to redraw a cell (rather than reloading it in order to update its information), you can use UIView
's setNeedsDisplay
method:
[[cell view] setNeedsDisplay];
Upvotes: 0
Reputation: 8069
If your data has been updated you can refresh the view by sending the reloadData message to your tableView:
[myTableView reloadData];
Apple's UITableView reference
Upvotes: 1