0
在這裏我使用核心數據與UICollectionView和這裏有一些問題發生時,我重新加載CollectionView。UICollectionView和核心數據
問題是,當我創建一個相冊並在其上設置了最新的照片(如果有任何照片存在其他明智的沒有相冊的圖像設置)從實體「PHOTO」獲取然後刷新集合視圖,然後這個相冊還在其自身上設置了一個圖像(一張專輯實際上是一個CollectionViewCell)。
它真的很刺激。如果有人能解決這個問題,那麼請引導我。
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
cell.backgroundColor = [UIColor yellowColor];
//Get Album Names
GMSAlbum *objAlbumEntity = [arrayAlbums objectAtIndex:indexPath.row];
NSLog(@"AlbumName = %@",objAlbumEntity.name);
delegate->currentAlbum = [arrayAlbums objectAtIndex:indexPath.row];
//NSLog(@"current path = %@",delegate->currentAlbum);
//Get Last image
NSString *imagePath = [self getLastImage:delegate->currentAlbum];
NSLog(@"Image Path = %@",imagePath);
if (![imagePath isEqualToString:@""]) {
UIImageView *imageThumb = [[UIImageView alloc] initWithFrame:
CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)];
[imageThumb setImage:[UIImage imageWithContentsOfFile:imagePath]];
[cell addSubview:imageThumb];
}
return cell;
}
-(NSString *)getLastImage:(Album *)album{
NSString *imagePath = @"";
GMSPhotoModel *objPhotoModel = [[GMSPhotoModel alloc] init];
NSMutableArray *arryPhotos = [objPhotoModel getAllPhotoForAlbum:album];
NSLog(@"Array count = %d",[arryPhotos count]);
if ([arryPhotos count]) {
GMSPhoto *objPhotoName = [arryPhotos lastObject];
imagePath = objPhotoName.path;
NSLog(@"Naming Album = %@",objPhotoName.name);
}
NSLog(@"Path = %@",imagePath);
return imagePath;
}
告訴你的要求......你是不是清楚...... –
爲什麼專輯,同時具有在專輯沒有照片設置圖像時重新加載數據 –
如果沒有圖像,您在iPad上查看/編輯MS Word文檔時會得到什麼? –