Calling [self.tableView reloadData]
works fine when adding a new row or deleting one. When deleting all rows and wanting to see an empty table, reloadData
has no affect. All of the phantom rows are still there until the app is relunched. I'm doing this on the RootViewController
, which is a UITableViewController
. Is there another way to refresh the table in this case?
Add a comment
|
1 Answer
You should try to use
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths
withRowAnimation:(UITableViewRowAnimation)animation
...on the UITableView when you delete some rows so you also get the animation when deleting
Otherwise a
[tableView setNeedsDisplay];
...might help
-
setNeedsDisplay never had any affect. I'm deleting from the database and not one row at a time. Not sure how deleteRowsAtIndexPaths can be used in that case. I just need to refresh the table.– 4thSpaceMar 1, 2009 at 21:18
-
Figured it out. Wasn't clearing out the source array after deleting from DB.– 4thSpaceMar 1, 2009 at 21:47