Andrea Sprega
Andrea Sprega

Reputation: 2271

NSManagedObjectContext: how to save certain entity properties without firing change notifications?

Is it possible to save the NSManagedObjectContext not firing a changed notification only for certain NSManagedObjects attributes?

I'm asking because I'm asynchronously downloading images and storing them in entities to be displayed on tableView which is driven by a NSFetchedResultsControlle. Since my delegate methods is basically:

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {

    [self.tableView reloadData];
}

I do not want to update the entire tableview everytime I download and save an image (which is an attribute of the entity I'm fetching) to the context, but just update the cell's imageView (through custom KVO code).

If you were wondering, the "image" attribute cannot be transient (I don't want to download the same image anytime the user starts the app).

Upvotes: 0

Views: 245

Answers (1)

user1226119
user1226119

Reputation: 324

I'm not sure about the filtering of certain update of attributes. But you have an other solution ... to keep the downloaded images using a Framework like SDWebImage https://github.com/rs/SDWebImage

Using UIImageView+WebCache category with UITableView

Your images will be downloaded just one time :)

Upvotes: 1

Related Questions