简体   繁体   中英

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.

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

在此处输入图片说明

There is an option in the storyboard to set the style to grouped but, in order to see it, you must first click in a specific area within the UITableViewController - you must zoom in and click near the top where it says "PROTOTYPE CELLS". This will select the UITableView itself (as opposed to the controller). Then, in the attributes inspector, you will see the dropdown to set the style to grouped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM