UICollectionView cellForItemAtIndexPath not registering cell

后端 未结 5 1561
甜味超标
甜味超标 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:10

    Try setting a breakpoint on

    [self.collectionView registerClass:[ImageCell class] forCellWithReuseIdentifier:@"MyCell"];
    

    I would guess your loadView (did you mean viewDidLoad?) method is not being called, so the class is never registered with the collectionView.

提交回复
热议问题