Confused with designated initializer


#1

I feel confused about the explanation of designated initializer. I can understand the part that “the creator of the instance should not need to know the name of the XIB file that the view controller uses, or even if it has a XIB file at all.” What I am not fully understand is why makes init the designated initializer.

Because I read from apple document Initialization that “designated initializer (is the one) which takes the full complement of initialization parameters.” Our book also says “the designated initializer has parameters for the most important and frequently used instance variables of an object.” So my understanding is that init and other initializers (with less parameters) are wrapper functions that call the designated initializer and init is the most common used (by “the creator of the instance”) initializer.

So the most common used initializer and the designated initializer are not the same thing(to me). Or put it in another way, init is supposed to be called by the users(client) of my class, while the designated initializer is supposed to be called by my own implementation and not by my user directly most of time. Does this understanding make sense ?


#2

[quote]
I feel confused about the explanation of designated initializer. I can understand the part that “the creator of the instance should not need to know the name of the XIB file that the view controller uses, or even if it has a XIB file at all.” What I am not fully understand is why makes init the designated initializer. [/quote]
Nothing makes init the designated initializer for view controllers. However, you can provide an init that calls the designated initializer:

- (id)init
{
     return [self initWithNibName:[[self class] description] bundle:nil];
}

This way the creator of the view controller is isolated from details such as the name of the nib file.


#3

The book said “In our subclasses of UIViewController, we always change the designated initializer to init.” and thus comes my question.

And actually you do not need to write your own init if it just calls initWithNibName b/c the default implementation of init of UIViewController already does that.