我有一个带有2个视图的nib文件,里面有UICollecitonView和UICollecitonViewCell。
在自定义单元格内部有两个想要填充的imageView。
我认为集合视图和单元格工作正常。如果我声明单元格的背景颜色或单元格的背景图像,它显示正常(颜色和想要的图像),但如果我用图像填充imageView,图像不会显示。
这是班级:
-(void) finishSearchingForPictures:(NSArray *)picturesList
{
_pictures=picturesList;
[_picturesCollectionView registerClass:[UploadPicturesCollectionCell class] forCellWithReuseIdentifier:@"Cell"];
[_picturesCollectionView reloadData];
// [self.albumViewController hideLoadingSpinner];
}
- (IBAction)uploadButtonClicked:(UIButton *)sender {
}
-(void)fillAlbumData
{
[super fillAlbumData];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UploadPicturesCollectionCell *cell = (UploadPicturesCollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
UIImageView *imageView=[[UIImageView alloc]initWithImage:[_pictures objectAtIndex:indexPath.row]];
cell.imageView=imageView;
return cell;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return _pictures.count;
}