I have a view controller which get called from several places, and the first time it is called, awakeFromNib is called, but viewDidLoad is not called. viewWillAppear and viewDidAppear are called each time.
Also, the view (a UITableView subclass) functions correctly, except that anything within viewDidLoad is obviously not implemented.
loadView is not overridden in this view controller.
the code used to override viewDidLoad and awakeFromNib:
- (void)awakeFromNib
{
// Configure for self sizing cells:
self.tableView.estimatedRowHeight = 44;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.allowsSelectionDuringEditing = YES;
self.clearsSelectionOnViewWillAppear = NO;
self.navigationItem.title = nil;
self.navigationItem.rightBarButtonItem = nil;
printf("\n awake from nib \n \n ---------- \n");
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.tableView.allowsSelectionDuringEditing = YES;
}
how is it possible that awakeFromNib is called but viewDidLoad is not, and how can I fix it?
edit: I received an answer that helped fixed it, however I would like to know why it happened, because it may be related to a bug in my app.
thank you.
This was a bit of a stab in the dark in a comment but it turned out to resolve the issue.
Ensure to call [super awakeFromNib]
in the overridden method.