UICollectionView display 3 items per row

后端 未结 7 580
离开以前
离开以前 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:22

    try this

     - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
    {
        return CGSizeMake(self.view.frame.size.width/3 -10 , (collectionView.frame.size.height-100)/2);
    }
    

提交回复
热议问题