How can I reload a UITableView without noticing the user behind the iDevice?
I’m updating my UITableViews datasource in -applicationWillEnterForeground: by sending a notification to my RootViewController that observes the notification and runs a selector that calls [self.table reloadData] but I want this update to be made in stealth and not showed to the user.
It seems that -viewWillAppear: is fired before -applicationWillEnterForeground:
I’m a little confused by your question, but I think what you’re looking for is a way to reload the data before it appears on screen, yes?
I’d say figure out a way to call your data refresh method directly, not via a notification. The notification de-couples the data refresh from
-applicationWillEnterForeground, giving the view time to appear.Sequence is probably something like this:
applicationWillEnterForegroundviewWillAppearNotification observer method is called
a) Notification observer method calls [self.table reloadData]
What you want is to couple your notification method to a method that gets called before the view appears. Call it directly from
applicationWillEnterForegroundorviewWillAppear.That way it’ll play out like this:
applicationWillEnterForegrounda) your data refresh method is called. (no need to call [self.table reloadData], the tableView hasn’t loaded the data at all yet.)
viewWillAppearor like this:
applicationWillEnterForegroundviewWillAppeara) your data refresh method is called. (no need to call [self.table reloadData], the tableView hasn’t loaded the data at all yet.)