0
votes

I have an Xcode storyboard project for an iPad app using SDK 7.0 and being deployed to iOS 6.1 and greater. In the storyboard there’s a tab bar controller with 2 navigation controllers, each of which points to a table view controller. The table view controllers are of the same class, just configured differently.

When I start the app (iOS 7 simulator), the table view controller’s awakeFromNib is called twice and the viewDidLoad is called once. The first table view appears correctly. When I tap the tab bar to display the second table view, viewDidLoad is not called a second time. The second table view appears incorrectly configured because the values in viewDidLoad were not set for it.

I realize I can configure the 2 table views in awakeFromNib and everything will be fine. I’d feel better if I understood why viewDidLoad is called only once, and what the intended purposes of awakeFromNib vs viewDidLoad are. From what I read on SO and other sites, viewDidLoad seems to be preferred to awakeFromNib for configuring a view.

Thanks

1

1 Answers

0
votes

awakeFromNib gets called multiple times for NIB objects awakening. If you want to configure stuff upon the view is loaded, use viewDidLoad