I don't think you have to call awakeFromNib on your super class.
Check this.
Edit
I just ran a quick test, here's the results:
Scenario 1:
MainWindow.Xib has a UIViewController subclass TestingAwakeFromNibViewController
, Which has it's own Nib file TestingAwakeFromNibViewController.xib
.
TestingAwakeFromNibViewController has an UIButton Outlet called btn3.
Testing the following code :
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Btn3 %@",btn3);
NSLog(@"viewDidLoad");
}
-(void) awakeFromNib
{
[super awakeFromNib];
NSLog(@"Btn3 %@",btn3);
NSLog(@"awakeFromNib");
}
Would Print:
Btn3 (null)
AwakeFromNib
Btn3 <UIRoundedRectButton: 0x64088e0; frame = (114 211; 72 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x6408890>>
ViewDidLoad
Scenario 2:
Removing the xib file, adding a UIView as a son to the TestingAwakeFromNibViewController inside MainWindow.Xib, and adding UIButton as a subview to the UIView (and connecting the UIbutton outlet to the appropriate outlet of TestingAwakeFromNibViewController).
Now running the above code would print:
Btn3 <UIRoundedRectButton: 0x4e31c30; frame = (114 211; 72 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4e31be0>>
viewDidLoad
Btn3 <UIRoundedRectButton: 0x4e31c30; frame = (114 211; 72 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4e31be0>>
awakeFromNib
Meaning ViewDidLoad prior to AwakeFromNib.
Third Scenario:
Same as the second, just without calling [super awakeFromNib];
Btn3 <UIRoundedRectButton: 0x4e0ddf0; frame = (114 211; 72 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4e0dda0>>
awakeFromNib
Now ViewDidLoad is not even getting called.
So, it seems like different scenarios are calling for different action, and we need to prepare ourselves according to the one we're acting upon.