1

In my RootViewController, I have IBOutlets. I can access them by viewWillAppear but they are all nil in awakeFromNib()

I am calling super.awakeFromNib()

Why are they all nil? Doesn't the Apple document guarantee that all the outlets from my view controller are initialized when awakeFromNib is called?

https://developer.apple.com/documentation/objectivec/nsobject/1402907-awakefromnib

Quote from the apple dev docs:

When an object receives an awakeFromNib message, it is guaranteed to have all its outlet and action connections already established.

aztrorisk
  • 161
  • 4
  • 10

1 Answers1

0

For a UIViewController method awakeFromNib is called when the controller is "awake" from Nib file. You should use viewDidLoad is you want to interact with outlets.

Maciej Gad
  • 1,701
  • 16
  • 21