2013-01-03

Custom container UIViewController from UIStoryboard order of operations.

Here is an iPad container view controller with two content view controllers setup in a storyboard:

I added logging to every relevant overridable UIViewController method to show the order that these methods get called upon app startup.

2013-01-03 10:13:38.960 Sandbox[11029:11303] -[SBAppDelegate application:didFinishLaunchingWithOptions:] [Line 16] Entered here.
2013-01-03 10:13:38.968 Sandbox[11029:11303] -[SBContainerViewController prepareForSegue:sender:] [Line 59] childViewController count = 0
2013-01-03 10:13:38.969 Sandbox[11029:11303] -[SBContainerViewController prepareForSegue:sender:] [Line 61] Fired segue = ZetaSegue
2013-01-03 10:13:38.970 Sandbox[11029:11303] -[SBZetaViewController viewDidLoad] [Line 30] Entered here.
2013-01-03 10:13:38.972 Sandbox[11029:11303] -[SBContainerViewController prepareForSegue:sender:] [Line 59] childViewController count = 1
2013-01-03 10:13:38.973 Sandbox[11029:11303] -[SBContainerViewController prepareForSegue:sender:] [Line 61] Fired segue = MuSegue
2013-01-03 10:13:38.974 Sandbox[11029:11303] -[SBMuViewController viewDidLoad] [Line 30] Entered here.
2013-01-03 10:13:38.975 Sandbox[11029:11303] -[SBContainerViewController viewDidLoad] [Line 27] Entered here.
2013-01-03 10:13:38.976 Sandbox[11029:11303] -[SBContainerViewController viewWillAppear:] [Line 34] Entered here.
2013-01-03 10:13:38.977 Sandbox[11029:11303] -[SBZetaViewController viewWillAppear:] [Line 38] Entered here.
2013-01-03 10:13:38.978 Sandbox[11029:11303] -[SBMuViewController viewWillAppear:] [Line 38] Entered here.
2013-01-03 10:13:39.283 Sandbox[11029:11303] -[SBContainerViewController viewWillLayoutSubviews] [Line 48] Entered here.
2013-01-03 10:13:39.284 Sandbox[11029:11303] -[SBContainerViewController viewDidLayoutSubviews] [Line 53] Entered here.
2013-01-03 10:13:39.286 Sandbox[11029:11303] -[SBMuViewController viewWillLayoutSubviews] [Line 52] Entered here.
2013-01-03 10:13:39.287 Sandbox[11029:11303] -[SBMuViewController viewDidLayoutSubviews] [Line 57] Entered here.
2013-01-03 10:13:39.288 Sandbox[11029:11303] -[SBZetaViewController viewWillLayoutSubviews] [Line 52] Entered here.
2013-01-03 10:13:39.289 Sandbox[11029:11303] -[SBZetaViewController viewDidLayoutSubviews] [Line 57] Entered here.
2013-01-03 10:13:39.290 Sandbox[11029:11303] -[SBMuViewController viewWillLayoutSubviews] [Line 52] Entered here.
2013-01-03 10:13:39.291 Sandbox[11029:11303] -[SBMuViewController viewDidLayoutSubviews] [Line 57] Entered here.
2013-01-03 10:13:39.292 Sandbox[11029:11303] -[SBZetaViewController viewWillLayoutSubviews] [Line 52] Entered here.
2013-01-03 10:13:39.294 Sandbox[11029:11303] -[SBZetaViewController viewDidLayoutSubviews] [Line 57] Entered here.
2013-01-03 10:13:39.328 Sandbox[11029:11303] -[SBAppDelegate application:didFinishLaunchingWithOptions:] [Line 20] Done here.
2013-01-03 10:13:39.394 Sandbox[11029:11303] -[SBContainerViewController viewDidAppear:] [Line 41] Entered here.
2013-01-03 10:13:39.395 Sandbox[11029:11303] -[SBZetaViewController viewDidAppear:] [Line 45] Entered here.
2013-01-03 10:13:39.396 Sandbox[11029:11303] -[SBMuViewController viewDidAppear:] [Line 45] Entered here.

Note: the methods view(Did|Will)LayoutSubviews gets called over and over again during regular application execution. Be careful what initialization code you put in there.

No comments:

Post a Comment