Why does my UITableView change from UITableViewStyleGrouped to UITableViewStylePlain
Posted
by casper
on Stack Overflow
See other posts from Stack Overflow
or by casper
Published on 2010-04-14T16:54:39Z
Indexed on
2010/04/14
17:23 UTC
Read the original article
Hit count: 431
iphone
|objective-c
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?
© Stack Overflow or respective owner