Reputation: 23233
Everything is in the storyboard using pretty standard layout.
UISplitViewController
with a detail view controller of UINavigationController
which loads up my custom UITableViewController
. Only the viewDidLoad
in the custom UITableViewController
never fires.
viewWillAppear
fires as expected and everything else works perfectly. The view clearly is loaded (the only thing not working is the notifications I setup in viewDidLoad
), by where is my callback?
My viewDidLoad
method...
Breakpoint,
NSLog
... there is no way these things wouldn't give me feedback if this method executed.
Upvotes: 1
Views: 6231
Reputation: 23
You've probably created Storyboard file after the creation of the project. If so, you should've deleted the strings from AppDelegate.m file:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
Upvotes: 1
Reputation: 4971
Check that the name of your view controller subclass is not colliding with another class.
In my case I absentmindedly retained the auto-generated project class prefix of 'MP' and thus the project's root view controller subclass was MPViewController.
MPViewController is not documented anywhere, but because the problem occurred only when linking against the MediaPlayer framework it's probably a safe bet that it's defined somewhere and when the Storyboard was loaded the app created an instance of it instead of an instance of my custom class.
Upvotes: 1
Reputation: 23233
I tried re-creating my storyboard by creating a new project using a the Split View template. Then copying in all the appropriate View Controllers. It worked as expected. (viewDidLoad
called normally).
I compared all my IB connections between the projects side by side... no difference. I then took my original project and deleted all the connections one by one then re-connented them (to the exact same thing they had been connected to). When I got done, I ran the code and everything worked. viewDidLoad
called.
I tried doing a diff between the non-working storyboard version and working one because nothing should have been different, but obviously something was. I couldn't make heads or tails of it Even though much of the XML was identical, many bits were different parts of the XML file which made standard diff unrealistic. It was more like a jigsaw puzzle of trying to find where the bits matched each other and I gave up after an hour of finding nothing.
So a horribly unsatisifying answer. It was IB related, most likely outlets (but I did re-type class names and stuff too.. again identical). Most likely it was my error and not Xcode's, but it doesn't look like I'll be able to pin the exact reason.
Thanks for suggestions, they helped me look in various directions which lead to the solution.
Upvotes: 5
Reputation: 80265
I suspect you are expecting viewDidLoad
to be called when it was already loaded and just updated perhaps from the master view controller. In this case it would not have to be reloaded from the nib/storyboard and thus viewDidLoad
would not be called.
Put a log statement into viewDidLoad
and you will see that it is called at least once.
Upvotes: 1