0

リーク機器は「cell.textLabel.text=str;」を指しています。メモリリークとして。セルを自動リリースしたので、理由はわかりません。

- (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;
}
4

1 に答える 1

0

文字列を取得するために使用する配列オブジェクトを解放していない可能性があります。また、配列から抽出した後に値をキャストしてみてください。

   str= [NSString stringWithFormat:"%@",(NSString *)[array objectAtIndex:indexPath.row]];
于 2012-05-12T06:07:26.853 に答える