【发布时间】:2011-05-18 00:25:18
【问题描述】:
我有一个 UITableViewController,我在 viewDidLoadMethod 中设置了一些属性,如下所示:
- (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"]]]];
}
应用显示一个 UIScrollViewController 和一个 UIButton。当按下按钮时,应用会显示一个模态 UINavigationController,并且该 UINavigationController 包含一个 UITableViewController。
由于某种原因,当我显示 UITableViewController 时,Leaks 会报告一些泄漏。但是,如果我注释掉//Set up the table 之后的四行,一切都很好。
当取消注释四行时,Leaks 工具显示以下内容:
我不确定这里发生了什么,但这真的很烦人。我之前使用相同的四行代码来自定义我的 UITableViewController,这是一种新行为。
可能出了什么问题?
【问题讨论】:
标签: iphone memory-management uitableview memory-leaks