0
我有一些(20 - 30)圖像存儲在應用程序中,並將它們加載到集合視圖時,它們從屏幕截圖中所示的小圖像開始滾動,然後滾動它們成爲正常尺寸。在收集視圖中緩慢加載圖像,swift
關於如何解決此問題的任何想法?非常困惑,爲什麼!
這裏是我的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
}
添加你的代碼在你的問題 –
是否設置圖像的約束是否正確?還需要設置UIImage內容模式爲AspectFit – iOSEnthusiatic
@Rushisangani我已經完成了這兩個。 – Gugulethu