Reputation: 353
I have a UITableView cell - I'm pulling info in from a network, and I have the following delegate method:
-(void)dataReturned:(NSString*)data indexPath:(NSIndexPath*)indexPath
{
MyTableViewCell *currentCell = (MyTableViewCell*)[self tableView:self.tableView cellForRowAtIndexPath:indexPath];
currentCell.someInfo.text = data;
currentCell.smallActivityIndicator.hidden = YES;
}
but unfortunately neither "someInfo" nor the smallActivityIndicator seem to be updated.
Any suggestions as to what I'm doing wrong?
Thanks!
Upvotes: 2
Views: 3830
Reputation: 9650
Are currentCell, someInfo or smallActivityIndicator equal to nil?
Are you caching 'data' elsewhere or are you relying on MyTableViewCell to store your data? You should probably be storing that string elsewhere.
Upvotes: 0
Reputation: 28572
Instead of getting the cell object and updating it, you could update your model with the new data and then call reloadRowsAtIndexPaths:withRowAnimation:
(reference). Reloading a row causes the table view to ask its data source for a new cell for that row. cellForRowAtIndexPath:
will get called and it will construct a cell object from the model (which already has the new data).
Upvotes: 8