![]() |
It's a best trick to grasp some fundamentals of UIKit before rushing into ios development.
Basically, loadView and viewDidload are the methods of UIViewController's lifecycle. I am going the explain the difference. |
The code of UIKit will call loadView event when it needs to present that controller's view hierarchy on screen.
This method is used to create a view hierarchy programmatically, without using a nib.
Especially, if any code tries to get your view property on view controller, and that property is nil, then UIViewController's will call the loadView method.
Note:
If you are using storyboard, you can't use loadView.
ViewDidLoad
In UIKit, viewDidLoad is called automatically when loadView completes all its tasks and the View is ready to display.That means all your IBOutlets are connected and you can make changes to labels, text fields, etc.
ViewDidLoad is used when you load your view from a XIB and want to perform any customization after launch.
Read:
How to Compare Dates in Objective C ?
20 Ultimate Ways To Promote Your Mobile Apps - Hunt My ideas
How to check if user declines Push Notification Prompt?