UICollectionView Custom Cell to fill width In Swift

后端 未结 11 2037
不思量自难忘°
不思量自难忘° 2021-01-30 21:12

I\'ve been trying to figure-out how can i make the cell fill the width, as you can see in the picture the width between the cells is too big. i am using custom cell with only on

11条回答
  •  臣服心动
    2021-01-30 21:45

    Swift 3

    If you are using swift 3, use this method:

        func collectionView(_ collectionView: UICollectionView,
                            layout collectionViewLayout: UICollectionViewLayout,
                            sizeForItemAt indexPath: IndexPath) -> CGSize {
    
        }
    

    Notice the changes:

    1. add _ before collectionView in the method name
    2. NSIndexPath changes to IndexPath

提交回复
热议问题