UICollectionView shows only the first item

前端 未结 4 938
灰色年华
灰色年华 2020-12-22 07:02

I\'m working on a project similar to a video album. In that I\'m using UICollectionView to display the thumb images of those videos. The worst part is that I sh

4条回答
  •  温柔的废话
    2020-12-22 07:35

    You do not need a counter. As indicated by Wain, use indexPath.row.

    Importantly, you should not create new subviews in cellForItemAtIndexPath, but rather use this method to fill them appropriately with content. You could put the image views into your storyboard prototype cells and identify them with tags. Each cell returned from dequeueReusableCellWithReuseIdentifier will already contain the image view.

提交回复
热议问题