How can I set a UITableView to grouped style


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.

Answers = UITableViewStyleGrouped


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.

By : drewh

You can use:

(instancetype)init {
return [[YourSubclassOfTableView alloc] initWithStyle:UITableViewStyleGrouped];

You can also try to make the separator line color clear which could give the grouped style effect:

[myTVContoller.tableView setSeparatorColor:[UIColor clearColor]];

This video can help you solving your question :)
By: admin