I have UICollectionView with UICollectionViewCell created in storyboard. I customized cell by adding to it UIImage. After user taps cell I want to show image from particular cell increased by size. To implement that I added UIImageView to view, situated it on top and made:
[previewImage setAlpha:0]; and [previewImage setHidden:YES]; in -viewDidLoad. At -didSelectItemAtIndexPath: I want to set value of image in this UIImageView to the appropriate in touched cell. I tried
previewImage.image = [(CustomCell *)[collectionView cellForItemAtIndexPath:indexPath] image].image;
but it don’t works. In logs I see that previewImage.image returns null. So how can I retrieve image value from cell in right way?
Solved by setting
previewImage.imagethis way:UIImage *preImage = [(CustomCell *)[collectionView cellForItemAtIndexPath:indexPath] image].image;[previewView setImage:preImage];