【问题标题】:iPhone/iPad : table view scroll crash in ipadiPhone/iPad:ipad 中的表格视图滚动崩溃
【发布时间】:2012-03-22 06:41:57
【问题描述】:

大家好,我想在 tableview 中显示更多 120 images,它在模拟器中运行良好,但在设备 (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;
}

请任何人帮助我哪里我错了..

【问题讨论】:

  • 你能运行仪器,看看其中哪一个泄漏了吗?
  • scaleImage会不会有问题?
  • 我用仪器没问题...

标签: iphone ipad


【解决方案1】:

实施:

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

并发布:

image and IMMage and FullTableView and topLevelObjects and dic before

    return cell;

最后也是最重要的一点:

还分析您的项目以查看泄漏

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    相关资源
    最近更新 更多