UICollectionView ne pas montrer des images de cellules

J'ai un viewcontroller et uicollectionview.

J'ai utilisé le code suivant, mais il n'y a pas d'images visibles dans uicollectionview, juste les cases jaunes :

myviewcontroller.h

{
IBOutlet UICollectionView *gallery1;
//IBOutlet UIImage *inimage;
NSArray *recipePhotos;
}

@property (nonatomic, retain) IBOutlet UICollectionView *gallery1;
//@property (nonatomic, retain) IBOutlet UIImage *inimage;

et myviewcontroller.m

- (void)viewDidLoad
{
[super viewDidLoad];

recipePhotos = [NSArray arrayWithObjects:@"im1.png","im2.png", "im3.png", "im4.png", "im5.png", "im6.png",  nil];

UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setItemSize:CGSizeMake(100, 100)];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
[self.gallery1 setCollectionViewLayout:flowLayout];
[self.gallery1 setAllowsSelection:YES];
self.gallery1.delegate=self;
}

- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection: (NSInteger)section {
return recipePhotos.count;
}

- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView {
return 1;
}

//cellforitematindexpath

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {

[gallery1 registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:[NSString stringWithFormat:@"c%d",indexPath.row]];
UICollectionViewCell *cell = [gallery1 dequeueReusableCellWithReuseIdentifier:[NSString stringWithFormat:@"c%d",indexPath.row] forIndexPath:indexPath];

cell.backgroundColor = [UIColor yellowColor];
UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:100];
recipeImageView.image = [UIImage imageNamed:[recipePhotos objectAtIndex:indexPath.row]];
[cell addSubview:recipeImageView];
return cell;
}

Je ne vois aucune image (fichier image sont existants) dans les cellules uicollectionview.

Merci pour toute aide.

Est-il résolu pour vous, Murat?
ouais, merci Matt.

OriginalL'auteur Murat Calim | 2013-07-07