Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between didFinishLaunchingWithOption and viewDidLoad

What is the difference between the two methods didFinishLaunchingWithOption and viewDidLoad?

The former is a method of AppDlegate.m and the latter is a method of ViewController.m, but both of them perform the same mission of loading the UIs onto the view.

like image 207
JackieLam Avatar asked Oct 24 '12 16:10

JackieLam


1 Answers

The application:didFinishLaunchingWithOptions: is a UIApplicationDelegate protocol method that gets called when iOS has finished setting up an area for your App to run and is the insertion point for you, the developer, to load a view controller, etc.

The viewDidLoad method on the other hand is a method of the UIViewController class that gets called when an instance of UIViewController gets its view loaded into memory. From Apple's documentation:

Called after the controller’s view is loaded into memory.

Discussion This method is called after the view controller has loaded its view hierarchy into memory. This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView method. You usually override this method to perform additional initialization on views that were loaded from nib files.

like image 156
Beltalowda Avatar answered Oct 05 '22 23:10

Beltalowda