Returns a newly initialized view controller with the nib file in the specified bundle.
- iOS 2.0+
- tvOS 9.0+
Name Or Nil
The name of the nib file to associate with the view controller. The nib file name should not contain any leading path information. If you specify
nibproperty is set to
Bundle Or Nil
The bundle in which to search for the nib file. This method looks for the nib file in the bundle's language-specific project directories first, followed by the
Resourcesdirectory. If this parameter is
nil, the method uses the heuristics described below to locate the nib file.
A newly initialized
This is the designated initializer for this class. When using a storyboard to define your view controller and its associated views, you never initialize your view controller class directly. Instead, view controllers are instantiated by the storyboard either automatically when a segue is triggered or programmatically when your app calls the
instantiate method of a storyboard object. When instantiating a view controller from a storyboard, iOS initializes the new view controller by calling its
init(coder:) method instead of this method and sets the
nib property to a nib file stored inside the storyboard.
The nib file you specify is not loaded right away. It is loaded the first time the view controller's view is accessed. If you want to perform additional initialization after the nib file is loaded, override the
view method and perform your tasks there.
For more information about how a view controller loads its view, see View Controller Programming Guide for iOS.