簡體   English   中英

iPhone / iPad:ipad中的表格視圖滾動崩潰

[英]iPhone/iPad : table view scroll crash in ipad

大家好,我想在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;
}

請任何人在我錯的地方幫助我..

實行:

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

並發布:

image和IMMage和FullTableView和topLevelObjects和dic之前

    return cell;

最后,最重要的是:

還分析您的項目以查看是否泄漏

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM