The UIViewControllers designated initializer, the method that all other initializers must call, is -initWithNibName:bundle: If you want to initialize something when your view controller is created, override this method.
-viewDidLoad designed for any installation, which depends on the type of controller. As you noticed, this method can be executed several times, since views can be loaded more than once. -awakeFromNib will not help if your view controller does not exist in it, and even then it makes sense only if the thing you initialize depends on other objects in the same nib.
Caleb source share