开发者

Change UITableViewController's style in Tab Bar application

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.


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.


May be this can help you


  • (void)viewDidLoad { [super viewDidLoad]; self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜