the uiviewcontroller class provides built-in support for loading a view controller’s views whenever they are needed. specifically, views are automatically loaded when the view property is accessed. there are a few ways you can implement your app to load these views:
you can specify the views for a view controller using a storyboard created in interface builder. a storyboard contains preconfigured view controllers and their associated views and is the preferred way to develop your app'ss user interface. a key advantage of storyboards is that they can express relationships between different view controllers in your app. for example, you can state that one view controller's contents are contained inside another view controller or that a view controller is displayed as a transition (known as a segue) from another view controller . by allowing you to see the relationships between view controllers, storyboards make it easier to understand your app's behavior at a glance.
at runtime, the view controller uses the storyboard to automatically instantiate and configure its views. often, the view controller itself is automatically created by segues defined in the storyboard. when you define a view controller's contents using a storyboard, you never directly allocate and initialize the view controller object. instead, when you need to programmatically instantiate the view controller, you do so by calling the instantiateviewcontrollerwithidentifier: method on a uistoryboard object.
you can specify the views for a view controller using a nib file, also created in interface builder. like a storyboard, a nib file allows you to create and configure a set of views. however, you cannot easily create or see the relationships between view controllers using nib files as you can when using storyboards.
to initialize your view controller object using a nib, you use the initwithnibname:bundle: method to specify the nib file used by the view controller. then, when the view controller needs to load its views, it automatically creates and configures the views using the information stored in the nib file.
if you cannot define your views in a storyboard or a nib file, override the loadview method to manually instantiate a view hierarchy and assign it to the view property.
all of these techniques have the same end result, which is to create the appropriate set of views and expose them through the view property.