UICollectionview不显示,有数据源,看图层也有渲染

根据数据源判断,如某个位置不想显示,设置ItemSIze为CGSizeZero,结果整个表都不显示。必须如下给个0.01的高度才能正常。
`

  • (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.section == 0) {
    if (self.dataArr.count > 0) {
    return CGSizeMake(SCREEN_WIDTH, 157);
    }
    }
    return CGSizeMake(SCREEN_WIDTH, 0.01);
    }
    `

posted @ 2023-03-08 10:55  JustToGo  阅读(87)  评论(0编辑  收藏  举报