UICollectionView's cellForItemAtIndexPath is not being called

后端 未结 30 2505
再見小時候
再見小時候 2020-12-07 11:11

Only my second time using UICollectionView\'s and perhaps I have bitten off more than I can chew but nevertheless:

I am implementing a UICollectionView (myCollection

30条回答
  •  被撕碎了的回忆
    2020-12-07 11:43

    For those who stumble here later.... the reason:

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

    was not being called was because of the itemSize for the collectionViewFlowLayout's height was too big.

    [self.myCollectionViewFlowLayout setItemSize:CGSizeMake(320, 548)];
    

    If I change the height to 410, it will execute cellForItemAtIndexPath.

提交回复
热议问题