Collection View Cells not appearing

前端 未结 14 834
迷失自我
迷失自我 2021-02-07 08:40

I want to display as many collectionViewCells with buttons as there are strings in my array. but when I start the simulator there is just the backgroun

14条回答
  •  孤城傲影
    2021-02-07 09:30

    Ideas:

    • Check if your cell reuse identifier is set up.
    • Check if you've set the collection view subclass correctly in the storyboard.
    • Put print statements inside your cellForItemAtIndexPath function to see if it's being called ever.
    • Not sure if this should be an issue, but Array is actually a type in Swift. Using that as your variable name might be messing with the logic somehow. Rename it to array (lowercase). I believe this is best practice for variable names anyway.
    • Do something else to the cell in cellForItemAtIndexPath, such as changing the background color. If that works, maybe there's just something wrong with what you're doing with tags.

提交回复
热议问题