All methods work at different times and in different circumstances.
awakeFromNib is called when the nib file associated with the class is loaded from disk. Any class that may have a tip can use it. viewDidLoad used only by view controllers. It is usually called when loading from nib, but it can also be called by a representation created in memory (a very rare circumstance.)
In any case, you only add functionality that you want to run only once when the instance is loaded first. For example. Nubia's common mistake is to put code in viewDidLoad , which should be run every time a view appears. Say, as with the main view, which opens the detailed view, and then reappears when the detailed view is rejected. If the main view code is in viewDidLoad , it will be run only the first time the main view is loaded, but not at subsequent times when the main view disappears and reappears.
Usually you do not initialize any other views or do anything in the delegate case of an application from nib. This is usually done in applicationDidFinishLaunching .
Techzen
source share