How to center align the cells of a UICollectionView in Swift3.0?

后端 未结 11 2062
不知归路
不知归路 2021-02-14 11:25

Description:

Answer for Objective-C and Swift2.0: How to center align the cells of a UICollectionView?

I usually would try to conver

11条回答
  •  一生所求
    2021-02-14 11:36

    The method that you are looking for is present with a different signature in Swift 3. The new signature is this:

    optional public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets
    

    P.S: This method is present in UICollectionViewDelegateFlowLayout protocol.
    Hope this would help.

提交回复
热议问题