How to Set a Uitableview to Grouped Style

How can I set a UITableView to grouped style

If i understand what you mean, you have to initialize your controller with that style. Something like:

myTVContoller = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];

Change UITableViewStyle to Plain programmatically in Swift?

I've resolved it with this code:

let datesTableView = UITableView(frame: CGRectZero, style: .Plain)

UITableView from storyboard - init with UITableViewStyleGrouped

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

Sample Image

How to change the style of a UITableViewController programmatically in Xcode

Not following? What do you mean by you don't have to "make a new table view"?? You still have to instantiate one.

Either you created one already and it has the style you want, or you have to instantiate a new one and set the property on it.

tableView.style is READONLY. So you can't change the style of an existing one. You are going to have to do something like:

[MyTableViewSubClass initWithFrame:aFrame style:UITableViewStyleGrouped];

How to create a grouped TableView without using a TableViewController

Setting the tableView's style property to .Grouped and return 2 from numberOfSections...-method should yield a good result. Where does this standard approach fail?

Grouped style setting not taking effect from IB, UITableView

Still not sure why the "grouped" style setting is not taking effect from the Interface Builder. However, you can manually set it before the view is created here:

- (id)initWithStyle:(UITableViewStyle)style {
// Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
style = UITableViewStyleGrouped;
if (self = [super initWithStyle:style]) {
}
return self;
}


Related Topics



Leave a reply



Submit