0

我正在尝试从 Picasa 帐户中的相册中获取照片缩略图。我正在使用 Collection View 来显示带有UIImageView单元格内部的相册,以显示相册中的一张照片。

问题是,有时当我运行代码时,单元格不反映缩略图并显示白色背景,但是当我在数据源方法中放置一个断点时——(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath;我可以看到图像被设置为单元格内的图像视图和最终在每个单元格上的照片之后。

我不想NStimer用来握住Segue。大家有什么建议请...

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier = @"Cell";

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

    // Configure the cell...
    GDataEntryPhotoAlbum *albumEntry = [app.albums objectAtIndex:indexPath.row];

    if(app.albums.count>albumThumbnails.count)
    {
        [[GDataPhotoWrapper sharedGDataPhotoWrapperInstance] setDelegateGDataPhotoWrapper:self];
        [[GDataPhotoWrapper sharedGDataPhotoWrapperInstance] fetchImageForSelectedAlbum:albumEntry];

    }


    cell.backgroundView     =   [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"photo-frame.png"]];

    UILabel     *albumTitle =   (UILabel*)[cell viewWithTag:200];
    albumTitle.text         =   [[albumEntry title] stringValue];

    if(albumThumbnails.count==app.albums.count)
    {
        UIImageView *thumbnail = (UIImageView *)[cell viewWithTag:1];
        thumbnail.image = (UIImage*)[albumThumbnails objectAtIndex:indexPath.row];
    }



    return cell;
}
4

0 回答 0