It is my understanding that awakeFromNib will always be called before viewDidLoad.
So I have a subclass of a UITableViewController, which is unarchived from a xib file.
I defined these two methods inside:
- (void)awakeFromNib {
[super awakeFromNib];
NSLog(@"awake from nib");
}
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"view did load");
}
what happens is that "view did load" shows up before "awake from nib" in the console. I tried to use a breakpoint at [super awakeFromNib], and repeatedly hit F7 (Step Into), and to my surprise, it stepped into -(void)viewDidLoad BEFORE going to the second line inside awakeFromNib.
Does anyone have a clue what is going on here? I did the exact same thing in a subclass of a regular UIViewController, and the log statements are reversed, as I initially expected...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…