search

Home  >  Q&A  >  body text

ios - 如何调整UICollectionView section的间距?

我想调整UICollectionView各个section的间距,我尝试了在下面这些布局方法中设置间距,但是都没起作用,我每个section都有一个headerView

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
        return UIEdgeInsetsZero
    }
    
        func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat {
        return 1
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAtIndex section: Int) -> CGFloat {
        return 5
    }
高洛峰高洛峰2766 days ago908

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-18 09:33:10

    Then you can add a footerView. FooterView can be used as a spacing

    reply
    0
  • 阿神

    阿神2017-04-18 09:33:10

    Reference here: http://www.huangyibiao.com/ar...

    reply
    0
  • Cancelreply