When my view controller is first presented, I want it to potentially update a cache that provides the data for that view. However, when the user taps the back button from a deeper view controller to return to this view controller, I don't want to update the cache again.
Which event should I be using?
- in
init
, I don't have all the parameters I need yet. viewWillAppear
will be fired every time the view will appear.viewDidLoad
will be fired every time the view has been loaded from the nib, which I believe could happen a second time if there's a memory warning. (Or is this wrong?) Since this is not a memory resident cache, it seems the wrong place to handle this.- having the caller call something extra is inelegant, if there's a built-in way to handle this.
To clarify, this is not a memory resident cache. This is parsing an XML file to binary. The binary is loaded and unloaded in viewDidLoad
and viewDidUnload
. This is a prerequisite for that step, making sure the binary is up-to-date prior to it being loaded.