2012-01-17 37 views
0

我在下面的代碼泄漏。泄漏百分比@行尾。誰能告訴我什麼是問題。當我從Xib文件加載自定義UITableViewCells時泄漏?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

coustomMessage *cell = (coustomMessage *)[tableView dequeueReusableCellWithIdentifier:@"coustomMessage"]; 
if (cell == nil) { 
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"coustomMessage" owner:self options:nil]; (93.1%) 
    cell = [topLevelObjects objectAtIndex:0]; 
} 

cell.nameLable.text = [self.nameArray objectAtIndex:indexPath.row]; (3.4%) 
cell.messageStatusLable.text = [[self.endPointCountArray objectAtIndex:indexPath.row] stringValue]; (3.4%) 

return cell;} 

回答

1

你確定你設置好的在你的XIB文件中的「標識符」屬性與你在代碼中使用相同的名稱(含:dequeueReusableCellWithIdentifier:@「coustomMessage」)?

+0

我是怎麼想到的。 Thx @meronix – AAV

+1

@Amit:它只是發生(對我來說)...你認爲我怎麼得到它? – meronix

0

棒極了!我有完全相同的問題,我拼錯了XIB中的標識符,因此我們正在重新創建的單元格沒有被重新使用,導致大量泄漏。謝謝!

相關問題