Alex Rivera | Logout

How can I set a UITableView to grouped style

Asked 2009-06-17T12:24:36.140
98

I have a UITableViewController subclass with sections. The sections are showing with the default style (no rounded corners). How can I set the TableView style to grouped in the code? I'm not using Interface Builder for this, so I need something like

[self.tableView setGroupedStyle]

I searched on Stack Overflow, but couldn't come up with an answer.

Edit
Report

2 Answers

-11

You can use:

(instancetype)init {
return [[YourSubclassOfTableView alloc] initWithStyle:UITableViewStyleGrouped];
}
answered 2012-03-27T06:36:08.440
-28
self.tableView.style = UITableViewStyleGrouped

EDIT:

Had assumed this was a read/write property. In that case, you can either follow Dimitris advice and set the style when you instantiate the controller, or (if you're using a XIB), you can set it via IB.

answered 2009-06-17T12:45:46.050

Your Answer