views:

1729

answers:

1

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?

+1  A: 

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

epatel
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.
4thSpace
Figured it out. Wasn't clearing out the source array after deleting from DB.
4thSpace