initWithNibName VS NSBundle's loadNibNamed

NSBundle’s methods are the generic API to use for unarchiving NIBs. They do the actual work (together with NSNib).

UIViewController’s initWithNibName:bundle: on the other hand is a way to initialize a view controller which (might) load its view from a nib. The method does not itself load the nib but just takes note of the name. The controller loads the nib lazily when the view is requested.

I’m not aware of any nib loading in UIView.


If your header's view controller contains IBOutlets to any fields in the nib file it will be better to load the nib file instead of calling initWithNib. In the view controller of the header file modify the initiation statement as the following .The default statement is commented out.
By doing so you will be able to access the fields in the nib file using the IBoutlets.

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    //self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    // Custom initialization.
    if ([[NSBundle mainBundle] loadNibNamed:@"NibFile" owner:self options:nil]) {

    }

    return self;
}