我有一个UITableViewController,我在viewDidLoadMethod
设置一些属性,像这样:UITableView泄漏?
- (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时,泄漏会报告一些泄漏。但是,如果我在//Set up the table
之后注释掉这四行,一切都很好。
当四行是注释掉,泄漏仪器显示以下内容:
我不知道这到底是怎么回事,但它真的很烦人。我之前使用过相同的四行代码来自定义我的UITableViewController,这是一种新行为。
什么可能是错的?
我不使用数组,我设置手动里面`cellForRowAtIndex`方法的一切。 – Moshe 2010-11-30 19:08:18
那么,什么泄漏是一个数组/字典的地方,根据你的泄漏图像。 – WrightsCS 2010-11-30 19:57:43
当我重新初始化UITableView时,它泄漏了旧的内容,因此NSArray泄漏。 – Moshe 2010-12-01 20:43:15