I am using storyboard instantiateViewControllerWithIdentifier:
and I'm noticing that all the IBOutlets
I have wired up are still nil. However, the IBActions
I have wired up work. The view and controller are linked (i.e controller.view is not nil), and if I show the view it displays what I am expecting.
What am I missing?
Here's my setup:
instantiateViewControllerWithIdentifier:
IBOutlets
and IBActions
.The view seems to be initialized properly only after it is accessed first. The problem goes away when calling
[self presentViewController:vc animated:NO completion:nil];
or more simply
[vc view];
[Use me as bad example]
Maybe not a good idea after all, it works but it violates the regular loading making the app unstable ^_^.
I'll leave the answer here in case someone else want to know if you do it.
I was having the same issue, however the custom component I designed isn't loaded via presentViewController (load in overlay to the previous view)
You can simply call
myViewController.loadView()
//Swift
[myViewController loadView]
//Obj-C
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With