首页 > collectionview的高度距离

collectionview的高度距离

没有设置任何的高度,就直接出现这种情况了,cell离collectionview的距离(黑色部分)怎么让他顶上去?
(橙色是backview)


在 UICollectionViewDelegateFlowLayout 中有这么个方法:

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
    return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}

UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 就是对应上左下右的间距。

【热门文章】
【热门文章】