I notice that there is no code to deal with images stored on the disk when a possession is removed from the table view. Wouldn’t this end up in bloating the storage for this application by leaving orphaned images in the Documents directory for our application?
Would modifying this code in the tableView:commitEditingStyle:forRowAtIndexPath: method in the ItemsViewController and the matching #import statement be the correct way to deal with this?
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Remove image from permanent storage
Possession *possession = [possessions objectAtIndex:[indexPath row]];
[[ImageCache sharedImageCache] deleteImageForKey:[possession imageKey]];
// Remove possession from array
[possessions removeObjectAtIndex:[indexPath row]];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
Or have I missed something?