UITableViewStyleGrouped looks like normal in iOS 6

When using the iOS 6 SDK and running my application in the iPhone 5.0 simulator, my table view looks just fine, like a grouped tableview style. However, when I run my iPhone 6.0 simulator, it displays as a UITableViewStylePlain table.

Any ideas what might cause this weird behavior? I am not doing anything crazy in the table view except for the text in the tableview cell.

+6
source share
2 answers

I have a grouped tableview that works correctly in iOS6 using code:

tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,self.bounds.size.width,self.bounds.size.height) style:UITableViewStyleGrouped]; [tableView setDataSource:self]; [tableView setDelegate:self]; 

Do you use an interface constructor to create this grouped table view, or do you create it programmatically? There seem to be several issues with iOS6 and previously created interface views.

If you use IB to create things, you can try to recreate the table view in the code (redundant and useless, I know, but this can show what the problem is).

Somewhere in your viewDidLoad () function is placed

  if(tableView) { [tableView removeFromSuperview]; } tableView = [[UITableView alloc] initWithFrame:tableView.frame style:UITableViewStyleGrouped]; [tableView setDataSource:self]; [tableView setDelegate:self]; [self addSubview:tableView]; 

This may be bad coding or cause a memory leak if you do not use an arc, but it would be interesting to see if you get a grouped style this way.

+6
source

This code solved for me the problem with ios6 grouping:

 tableView.backgroundColor = [UIColor clearColor]; tableView.opaque = NO; tableView.backgroundView = nil; 
+3
source

Source: https://habr.com/ru/post/925934/


All Articles