Search code examples
iosuitableviewstoryboardgrouped-tableinitwithstyle

UITableView from storyboard - init with UITableViewStyleGrouped


How do you initialize a UITableViewController to have UITableViewStyleGrouped when it is created in a storyboard? Normally I would create a grouped table view like this:

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle: UITableViewStyleGrouped];
    if (self) {
    }
    return self;
}

But I realized that this function does not run when you create the UITableViewController in the storyboard. And I do not see any option in the storyboard to set the style to grouped.


Solution

  • Below is a screenshot showing you the option to set group but don't forget to select tableView in your storyboard.

    enter image description here