I have a few (20 - 30) images stored the app and on loading them on to a collection view, they start off small as shown in the screen shot and on scrolling they become the normal size.
Any ideas on how to fix this? Quite confused on why!
Here is my code for the cellForItemAtIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cellSelected = iconCollectionView.dequeueReusableCellWithReuseIdentifier("IconCell", forIndexPath: indexPath) as! IconCollectionViewCell
cellSelected.workoutImage.image = iconsArray[indexPath.item].exerciseIcon
cellSelected.layer.shouldRasterize = true
cellSelected.layer.rasterizationScale = UIScreen.mainScreen().scale;
return cellSelected
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? CollectionViewCell
cell?.imageth.image = UIImage(named: (arrayName[indexPath.row] as? String)!)
return cell!