我正在尝试从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;
}