AwakeFromNib not being called in my ViewController

I have a view controller that is created through initWithNibName, and I just found out that awakeFromNib is not being called. Is awakeFromNib called only when the view controller has no analogues from Nib? (i.e. initWithCoder is called)

+6
iphone
source share
3 answers

I think you are looking for viewDidLoad . awakeFromNib is called only for objects loaded from nib. The controller itself receives viewDidLoad: Since you are calling initWithNibName:bundle: it is not actually archived from nib!

+17
source share

The UIViewController lazily loads its view only when it is needed to display. This applies to how to programmatically create a view using -loadView or unarchiving from nib.

You can force the view to load by specifying the view property of the UIViewController.

+4
source share

awakeFromNib is not called for placeholder objects such as File Owner and First Responder in iOS. See No. 4 in Object Loading Process Documents

+2
source share

All Articles