Reputation: 3931
I have a UITableViewCell subclass with labels, indicator views, etc. I need it to update as data is retrieved from the web (specifically I have a label for number of results).
I used this to try and reload the cells, but it doesn't work. I know that cellForRowAtIndexPath is being called, and the value that the data source itself is updated.
[self.myFriendsTbl beginUpdates];
[self.myFriendsTbl reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
[self.myFriendsTbl] endUpdates];
Upvotes: 0
Views: 1756
Reputation: 14068
[self.myFriendsTbl reloadData];
This will force each visible UITableViewCell
to be reloaded. cellForRowAtIndexPath
will be called for each of them.
Upvotes: 2
Reputation: 4254
You don't need to call beginUpdates or endUpdates since you are not deleting or inserting cells.
Just change the data for the specific row in the DataSource and call
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
as you were doing.
If it doesn't work maybe you are not changing the correct row or you are indexPath is not the right one. Show some more code to check that. Using some kind of animation like "UITableViewRowAnimationLeft", for example, will help you see which cell is being changed.
Upvotes: 0