It's less than optimal, but the simplest solution is to call -reloadData
on the table.
A better solution would be to call -beginUpdates
, -deleteRowsAtIndexPaths:withRowAnimation:
, -insertRowsAtIndexPaths:withRowAnimation:
, and -endUpdates
or simply -reloadSections:withRowAnimation:
if targeting 3.0 only. THis will add animation.
Edit: And you will also need a proper tableView:heightForRowAtIndexPath:
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
CGSize textSize = [[cell text] sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake([tableView frame].size.width - 20, 500)];
return textSize.height + 13;
}