Skip to content

Instantly share code, notes, and snippets.

@aquarius
Created January 24, 2012 09:46
Show Gist options
  • Save aquarius/1669307 to your computer and use it in GitHub Desktop.
Save aquarius/1669307 to your computer and use it in GitHub Desktop.
UIViewController init
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
static NSString *nibName = @"MYViewController"
self = [super initWithNibName:nibName bundle:nibBundleOrNil];
if (!self) return;
return self;
}
MYViewController *vc = [[MYViewController alloc] init];
@chbeer
Copy link

chbeer commented Jan 24, 2012

That code is too much, IMHO. You can simply remove the whole initWithNibName:bundle: as your nib name is the same as your class name. -[UIViewController init] is the same as -[UIViewController initWithNibName:nil bundle:nil] which loads the nib with the same name as the class name. My 2ct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment