Posts

Showing posts from October, 2019

iOS View Controller Lifecycle

View Controller Lifecycle: Lifecycle is an event that has several steps from the point of creation to deletion. It is a sequence of methods as you progress. init(coder: ):- Gets called only once when the view is being created in the storyboard. loadView(); when we instantiate a view controller programmatically we need to override this method. Called only once. When we work with creating a view in storyboard. LoadView method in the UIViewcontroller is called automatically to load the Interface files to the screen along with all the outlets hooked up. viewDidLoad(): This method gets called once the view is created. It's called only once. Good place to start some background activity like making network calls that happen only once. viewWillAppear(): This gets called called several times, whenever view appears on screen. Good place to update the ui with data that has changed whenever the view is not on screen viewDidAppear(): This method gets called once the view