I have a UITabbar
with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using NSFetchedResultsController
.
Here's the behaviour that I would like to achieve:
Upon disappearing, the UITableView stops updating, and when the user comes back, the entire table view is reloaded. Otherwise, inserting events from the other controller takes longer, as new rows are created in the UITableView
, even thought it is not visible.
I'm wondering how I can achieve this behavior, as it doesn't seem to work as I expect it would be:
I have set the delegate of the NSFetchedResultsController to nil in viewWillDisappear
, and restore it in viewWillAppear
, along with a call to [UITableView reloadData]
;
Somehow, I do not see the new data, and suspect this is due to the way NSFetchedResultsController stops fetching if it does not have a delegate.
How can I properly "suspend" updates to UITableView
when it disappears, but still able to see the entire dataset when the controller reappears?
beginUpdates
atcontrollerWillChangeContent
andendUpdates
atcontrollerDidChangeContent
are "freezing" FRC thread for some time. – Microeconomics