2012-03-22 93 views
0

大家好我想在tableview中显示超过120 images其在模拟器中运行良好,但在设备(ipad)中崩溃。 日志显示内存警告,但我完全释放我不知道为什么我得到这个消息和崩溃。图片来自服务器我正在使用以下代码。iPhone/iPad:表视图滚动崩溃在ipad中

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    FullTableViewCell *cell = (FullTableViewCell *) 
    [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     NSArray *topLevelObjects = [[NSBundle mainBundle] 
            loadNibNamed:@"FullTableViewCell" owner:nil options:nil]; 
     for (id currentObject in topLevelObjects) {   
      if ([currentObject isKindOfClass:[UITableViewCell class]]) { 
       cell = (FullTableViewCell *)currentObject; 
       break; 
      } 
     } 
    } 

    NSDictionary *dic = [socketConnection().imageInfoArray objectAtIndex:indexPath.row]; 
    int imageId = [[dic objectForKey:@"id"] intValue]; 

    UIImage *image = [socketConnection().serverImageArray objectAtIndex:indexPath.row]; 
    UIImage *IMMage = [self scaleImage:image toResolution:740]; 


    cell.cellIMage.image = IMMage; 
    cell.addButton.tag = imageId; 
    cell.zoomOutButton.tag = imageId; 
    [cell.zoomOutButton addTarget:self action:@selector(_ZoomOut:) forControlEvents:UIControlEventTouchUpInside]; 
    [cell.addButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; 
    cell.transform = CGAffineTransformMakeRotation(3.14159265+(3.14159265/2)); 

    cell.selectionStyle = UITableViewCellSelectionStyleNone; 


    return cell; 
} 

PLZ人帮助我在哪里,我错了..

+0

可以运行工具,看看其中哪一个正在泄漏? – 2012-03-22 08:02:31

+0

'scaleImage'可能有问题吗? – 2012-03-22 08:25:31

+0

我使用仪器没有问题,... – user745048 2012-03-22 08:29:30

回答

0

实现:

if (cell) { 
[cell setImage:nil]; 
[cell setImage://image]; 
// Put ALL cell code here 
} 

和释放:

图像和IMMAGE和FullTableView和topLevelObjects和DIC前

return cell; 

最后也是最重要的:

也分析你的项目,看看是否有泄漏