Sobes.tech
Junior — Middle

How many times is the loadView method called in the lifecycle of UIViewController?

sobes.tech AI

Answer from AI

The loadView method in the UIViewController lifecycle is called exactly once — when the controller loads its root view into memory.

If you do not override loadView, then UIViewController automatically loads the view from a storyboard or nib file. However, if you override loadView, you must create and assign the view property yourself.

After the first call to loadView, the controller retains the view, and this method is not called again until the view is unloaded from memory (for example, in low memory situations where the view is unloaded). Thus, in a typical scenario, loadView is called once during the controller's lifecycle.

How many times is the loadView method called in the… - sobes.tech