UICollectionView cellForItemAtIndexPath not registering cell

后端 未结 5 1649
甜味超标
甜味超标 2021-02-06 23:15

I am trying to use UICollectionViewCell, since all I want to display is an image. I can add the image to the cell using UIColor colorWithImage: on the

5条回答
  •  广开言路
    2021-02-07 00:03

    if your collection view is connected on storyboard and the delegate and datasource is set there, and you provide the necessary methods for the datasource and delegate, then adding the register call makes the

    - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
    

    return a UICollectionView instead of your own subclass of it. So do either but not both.

提交回复
热议问题