loadNibNamed returns NSArray in my case


I am new to ios programming. Chapter 9 tells me that I should be able to add the headerView xib file by using:

- (UIView *)headerView { // If you have not loaded the headerView yet... if (!_headerView) { // Load HeaderView.xib [[NSBundle mainBundle] loadNibNamed:@"HeaderView" } return _headerView; // THIS will return nil, using Xcode 6.2 }

However, in my case (using Xcode 6.2) _headerView remains null. I figured out that loadNibNamed returns back an NSArray. I am unsure about this, but I used this line of code to load in the headerView:

NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"HeaderView" owner:self options:nil]; _headerView = [nibContents lastObject];

Could someone delight me why is this different for me? Thanks.


Is your headerView outlet correctly configured?