UICollectionView display 3 items per row

后端 未结 7 592
离开以前
离开以前 2020-12-16 03:30

I have a UICollectionView created from storyboard,

I want to have 3 items per row in the view. I managed to do that using the following:

    - (CGSiz         


        
7条回答
  •  清歌不尽
    2020-12-16 04:21

    - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
        return CGSizeMake(self.collectionView.bounds.size.width/3, self.collectionView.bounds.size.width/3);
    }
    

    Most important thing need to do as well is in size inspector of collectionView set up the minimum spacing for cell & line to 0

提交回复
热议问题