I have a UITableViewController and I set some properties in the viewDidLoadMethod like so:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self.parentViewController.parentViewController action:@selector(dismissSettings)] autorelease];
[self setTitle:@"Gabbai Settings"];
//Set up the table
[self.tableView initWithFrame:self.tableView.frame style:UITableViewStyleGrouped];
[self.tableView setRowHeight:65.0];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLineEtched];
[self.tableView.backgroundView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@_settings", kTheme] ofType:@"png"]]]];
}
The app shows a UIScrollViewController and a UIButton. When the button is pressed, the app displays a modal UINavigationController and that UINavigationController contains a UITableViewController.
For some reason, Leaks reports some leakage when I show the UITableViewController. However, if I comment out the four lines after //Set up the table, everything is fine.
When the four lines are uncommented, the Leaks instrument shows the following:

I’m not sure what is going on here, but it’s really annoying. I’ve used the same four lines of code before to customize my UITableViewController and this is a new behavior.
What could be wrong?
As has been pointed out by other answers, your problem is the line:
It will create a new
UITableViewobject and it will not modifyself.tableViewwhich means that line is totally pointless. It only creates the leak you are experiencing. Remove it and you should be fine.