2012-05-12 8 views
0

リーク機器が "cell.textLabel.text = str;"をポイントしていますメモリリークとして。なぜ私がセルを自動リリースしたのか分からない。あなたはStrings.Alsoを取得するために使用配列オブジェクトをリリースしていない可能性がありますiOSメモリリークcellForRowAtIndexPath

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

static NSString *MyIdentifier = @"MyIdentifier"; 

// Try to retrieve from the table view a now-unused cell with the given identifier. 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 

// If no cell is available, create a new one using the given identifier. 
if (cell == nil) { 
    // Use the default cell style. 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease]; 
} 

// Set up the cell. 
NSString *str = [array objectAtIndex:indexPath.row]; 
cell.textLabel.text = str; 

return cell; 
} 
+0

何が 'NSStringのを使用してみた場合* STR =として配列から抽出した後に値をキャストしてみてください[NSString stringWithString:[配​​列objectAtIndex:indexPath.row]]; '? – Majster

答えて

0

str= [NSString stringWithFormat:"%@",(NSString *)[array objectAtIndex:indexPath.row]]; 
関連する問題