PSCollectionView's delegate not fire

前端 未结 3 1024
走了就别回头了
走了就别回头了 2021-01-26 03:00

I followed PSCollectionView\'s usage on Github.

This is my code:

- (void)viewDidLoad
{
  self.collectionView = [[PSCollectionView alloc] init];
  self.co         


        
相关标签:
3条回答
  • 2021-01-26 03:22

    it's because you have typo , it's not ViewDidLoad() it's viewDidLoad(), so your ViewDidLoad() normally never gets called. So, you're not able to set your delegate and datasource properly.

    0 讨论(0)
  • 2021-01-26 03:23

    Try adding

    [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];

    at the end of your viewDidLoad.

    Usually you need to tell your collectionView what Cells/Views to use.

    0 讨论(0)
  • 2021-01-26 03:39

    Finally I can make it works!

    You must set the PSCollectionView instance's frame.

    0 讨论(0)
提交回复
热议问题