Initializing ItemsViewController


#1

I am slightly confused how the book initializes ItemsViewController in the beginning of the Chapter.
I will explain what I mean.

The book taught us, we could implement a designated initializer and let other initializers use
this designated initializer.

The book also says that designated initializer of UITableViewController is initWithStyle:.
Then it goes like this:

[code]
// In the implementation of ItemsViewController

-(id) init
// Call the superclass’s designated initializer
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {

}
return self;

}

  • (id)initWithStyle:(UITableViewStyle)style
    {
    return [self init];
    }[/code]

I would rather expect such implementation according to what I described before:

[code]
// In the implementation of ItemsViewController

// Implement the designated initializer first
-(id) initWithStyle:(UITableViewStyle)style
// Call the superclass’s designated initializer
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {

}
return self;

}

// Call designated initializer

  • (id)init
    {
    return [self initWithStyle: nil];
    }[/code]
    Can someone please explain me my confusion?