Reputation: 332
I am using a UICollectionView
to show an array of images, horizontally and zoom in/out that image in the cell with the help of scroll view using constraints. But when I scroll horizontally it shows me previous cell content in the current cell. I am and not able to identify what is the problem.
CollectionView datasources
Upvotes: 0
Views: 600
Reputation: 478
The contentSize of the scrollView should be as big as imageView.image.size, or just use MWPhotoBrowser
Upvotes: 0
Reputation: 3699
Please share some code so that we can help you better. Meanwhile, make sure you have the following parts working correctly in your code:
Register correct UICollectionViewCell subclass with correct reuse identifier
Use the method [self.collectionView dequeueReusableCellWithReuseIdentifier:itemIdentifier forIndexPath:indexPath]
and pass both the parameters correctly.
In UICollectionViewCell subclass, override prepareForReuse
and reset the UI parameters there.
Override prepareForReuse
in imageCell class, and set imageView.image to nil.
Upvotes: 0
Reputation: 139
try this when you reuse the Cell in cellForItem at
cell.imageView.Image = nil
Upvotes: 0