You will need to pass the name of NIB with that call to initWithNibName:bundle:
:
MyAwesomeViewControllerClass *pViewController = [[MyAwesomeViewControllerClass alloc]
initWithNibName:@"MyAwesomeViewControllerClass"
bundle:nil];
I usually override init
:
- (instancetype)init {
// NOTE: Not [self initWithNibName:bundle:] !!!
self = [super initWithNibName:@"MyAwesomeViewControllerClass" bundle:nil];
if (self) {
// Other init
}
return self;
}
and then:
MyAwesomeViewControllerClass *pViewController =
[[MyAwesomeViewControllerClass alloc] init];
is easier to type and doesn't require users of the view controller to know the NIB being used (even if it is obvious).