tags:

views:

280

answers:

1

I have a tab bar iPhone application with 4 tabs. In the Interface Builder I set view controllers for each tab.

I want to change style from plain to grouped for one UITableViewController.

I replace init method something like this:

- (id)init
{
    self = [super initWithStyle:UITableViewStyleGrouped];
    if (self != nil) {
        // Initialisation code
    }
    return self;
}

but no luck.

There is no code where I can call initWithStyle method.

Please advice how to change style for my UITableViewController in tab bar.

A: 

If your view is created through Interface Builder the init method wont be used.

Objects loaded from a *.(nib|xib) are inited with:

- (id)initWithCoder:(NSCoder *)inCoder;

So you could override that or if doing your setup after -initWithCoder: is called is not a problem you could use:

- (void)awakeFromNib;

from the NSNibAwaking protocol.

willcodejavaforfood