objective-ciphoneios5viewdidloadloadview

Difference between viewDidLoad and loadView?


Two objective-c methods, -(void) viewDidLoad and -(void)loadView are methods called upon execution of a program but whats the different between them?


Solution

  • Do you mean viewDidLoad and loadView? viewDidLoad is a method called when your view has been fully loaded. That means all your IBOutlets are connected and you can make changes to labels, text fields, etc.

    loadView is a method called if you're (typically) not loading from a nib. You can use this method to set up your view controller's view completely in code and avoid interface builder altogether.

    You'll typically want to avoid loadView and stick to viewDidLoad.