PHP中文网2017-04-18 09:30:50
You can use autolayerout to set it in the storyboard. This is my general approach because it is simple and fast. Alternatively, you can use this protocol UICollectionViewDelegateFlowLayout
Rewrite a function of the collectionview below
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
return sectionInsets
}
Then define the following variable outside the function, which is the same as the value returned above.
private let sectionInsets = UIEdgeInsets(top: -5.0, left: 5.0, bottom: 0.0, right: 5.0)
For the rest, you can refer to this http://www.cnblogs.com/ios8/p...
巴扎黑2017-04-18 09:30:50
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
return sectionInsets
}
Override this method, which is used to specify the interval, the upper, lower, left, and right intervals.
Welcome to follow Brother Biao’s technical blog: http://www.huangyibiao.com/