Where to set UITableview style to grouped style

My tab controller has a tabular view that displays as the first and initial view. The view controller class is a subclass of uitableviewcontroller, so I do not use XIB for this. Since I give the view name directly in the interface builder for the MainWindow tab view, I'm not sure where I can set the tableview style that appears in the “normal” style at the moment. I want to change it to “grouped”, however there is no code in which I call and allocate the table controller (in this case I would use initWithStyle).

Any ideas on how to change the original table view to a grouped style instead of a simple style?

I also tried to override initWithStyle and set it as shown below, but it doesn't 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;
}

Thank,

+5
source share
2 answers

Try the following:

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

Replace with the UITableViewname of your custom class

+1
source

you can select tableview from .xib and set the style to grouped

+1
source

All Articles