NebulaFox
NebulaFox

Reputation: 8313

A Difference on ViewControllers and Nibs

I have been doing a lot of work on UIViewControlers and Nibs and notice there are two ways of doing it.

@class AController : UIViewController

[[AController alloc] initWithNibName:<name of nib> bundle:nil];

and the other way is that you make the File Owner the the UIViewController and link the View. All you have then do is

[[AController alloc] init];

or have it done else where, like in other nib files (I think). For me, the latter is so much easier, so when explain how to load a nib file, why do they always use the first? And is there any difference, like performance-wise?

Upvotes: 0

Views: 85

Answers (1)

Michal
Michal

Reputation: 4875

init is just a convenience method that will load nib based on view-controller's name. If you provide the same name to initWithNibName:bundle:, then it is absolutely the same. There is practically no performance difference.

Upvotes: 1

Related Questions