Why does my UITableView change from UITableViewStyleGrouped to UITableViewStylePlain
- by casper
My application has a view controller that extends UITableViewController. The initialization method looks like this:
- (id)initWithCoder:(NSCoder*)coder {
if (self = [super initWithCoder:coder]) {
self.tableView = [[UITableView alloc] initWithFrame:self.tableView.frame
style:UITableViewStyleGrouped];
}
return self;
}
When the view is initially loaded, it's displayed as UITableViewStyleGrouped. However, if my app ever receives a low memory warning, the above view changes to UITableViewStylePlain. There is no associated xib file with the View/Controller. The viewDidUnload and didReceiveMemoryWarning methods are straightforward:
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
My question is, why does the table style change when I receive a memory warning?