I have a UITableView based on a NSFetchedResultsController. To insert a new row into the table, I open up a modal view controller, and I then hit the save button which dismisses the modal view and causes my NSFetchedResultsController delegate methods (willChangeContent, didChangeObject`, etc) to fire, which animates the inserting of a new cell. All is fine, but I want the user to witness this animation, and by the time the modal view has disappeared, the animation has already completed.
How can I delay this animation until the modal view completely disappears, so that the user can witness the animation?
This is a good question with or without the NSFetchedResults controller – you have a table vc that’s observing a model, and you want the user to see an animated change after a pop or dismiss from another view controller.
There’s probably a better way, but the thing I did in a similar situation recently was to make the table vc do the model update itself, based on a delegate message from the subsidiary (pushed or modally presented) vc.
So, in the table vc:
The adding vc does this (and I’m not totally proud of this, but it works)…
In my case, I used a more conventional delegate protocol, passing the addingVC as the first param, but doing so with delay requires a verbose NSInvocation, so I skipped it here. +1 for the question that’s bothered me, too. I’m curious about others’ solutions.