What are the differences between didFinishLaunchingWithOption and viewDidLoad

iphone, viewdidload

Solution

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.

Problem

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.

Original source