tarheel
tarheel

Reputation: 4797

tableView not updating after adding Core Data object

Given this Core Data Model: Photographer <-->>Photos.

After adding a Photographer via a Modal View, the tableView of Photographers updates accordingly.

The problem is, that it doesn't do the same for Photos. I can add a Photo via a Modal View, and the tableView of Photos for that particular Photographer does not update immediately. Once I navigate back to the tableView of Photographers and select the same Photographer again, it updates as expected.

How can I get the tableView of Photos to update as soon as the Modal View(where the user added the object) gets dismissed?

Upvotes: 0

Views: 763

Answers (4)

Sarabjit Singh
Sarabjit Singh

Reputation: 1824

Where modal view dismiss try to use:

[tableView reloadData];

Upvotes: 1

Hiren
Hiren

Reputation: 12780

Check your array first is it fill or empty? try with NSLog and check it. if it exist then reload your table

Upvotes: 0

Christian Kienle
Christian Kienle

Reputation: 753

  1. Check your error variable if it contains an error.
  2. You directly assign the result of -executeFetchRequest:error: to an ivar (photographerPhotosArray). This either leaks or causes an immediate release.
  3. Consider switching to NSFetchedResultsController since it helps you a lot.

Upvotes: 0

Stark
Stark

Reputation: 441

Try

 [tableview reload];

method after getting new data.

Upvotes: 0

Related Questions