Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to set UITableview style to grouped style

My Tabview controller has a tableview appearing as the first and initial view. The view controller class is a subclass of uitableviewcontroller, so I am not using XIB for this. Since I am giving the view name directly in the interface builder for the MainWindow of the tab view, I am not sure where I can set the style of the tableview, which appears in 'plain' style at the moment. I want to change it to 'grouped', however there is no code where I call and allocate the tableview controller (in which case I would have used the initWithStyle).

Any ideas on how I can change this initial tableview to grouped style instead of plain style?

I also tried overriding the initWithStyle and set it like below, but does not work.

- (id)initWithStyle:(UITableViewStyle)style {
    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
    self = [super initWithStyle:UITableViewStyleGrouped];
    if (self) {
        // Custom initialization.
    }
    return self;
}

Thanks,

like image 594
user542584 Avatar asked Nov 04 '22 22:11

user542584


1 Answers

Try the following then:

UITableView* table = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped];  

Replace UITableView by the name of your custom class

like image 183
HG's Avatar answered Nov 10 '22 17:11

HG's