【发布时间】:2012-01-19 00:58:05
【问题描述】:
在我的 tableview 单元格中的应用程序中,我使用了以下代码行 当我的应用程序用于分析时,我得到了以下泄漏
代码:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
//}
// Configure the cell...
}
我收到这样的错误:
在初始化期间存储到单元格的值永远不会被读取
【问题讨论】:
-
你做了两次
cell =,所以第一个分配当然丢失了。
标签: objective-c memory-management memory-leaks uitableview