When I call performSegueWithIdentifier: I am overriding prepareForSegue: afterwards in order to set some properties on my destination view controller. However, I’m trying to understand the order of operations here to make sure it’s safe.
I instantiate the destination view controller with:
MyViewController *myVC = (MyViewController*)segue.destinationViewController;
Afterwards I set a few properties on it – namely, I initialize the creation of another object which handles loading different web views, and then set properties on that object:
[myVC setFormHandler:
[[WebFormHandler alloc] initWithSelectedFormName:[self theFormName]]];
In viewDidLoad: of my destination controller, I then query the properties on this object, and use this to load the correct web view. Now, I am slightly confused by which happens first – the setting of the properties, or viewDidLoad: on the destination controller. Can it be said for certain that the properties of the view controller will always be set from prepareForSegue: before the viewDidLoad: is called?
It looks like you may have found your answer from that other post, but I just wanted to add one point of clarification.
The standard flow is
performSegue -> prepare -> loadView (in destination controller)
However, in popover segues, the destination view is loaded prior to the prepareForSegue call.
NOTE: This is no longer the case in iOS 8. In iOS 8, popover segue’s views are NOT loaded by the time prepareForSegue is called.