I'm trying to make a view controller that will always load the same nib. My initialization code looks like this:
-(id)init
{
NSString* nibName;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
nibName = @"XIB_iPad";
else
nibName = @"XIB_iPhone";
self = [super initWithNibName:nibName bundle:nil];
if (self)
{
...
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
return [self init];
}
The problem is that this code results in the view controller having a nil view. Is there something I'm doing wrong here? Is there a better way to do this?
Thanks.