0
各行に2つのアイテムがあり、各アイテムはアイテム間の間隔に等しいパディングを持つレイアウトを作成したいと思います。例えば、アイテム間の間隔は、アイテムとエッジ間の間隔と等しくなければならない。私はアイテム間で水平に等間隔になるように管理しましたが、垂直方向には大きすぎます。どうすれば修正できますか?UICollectionView - 各行に2行と等しい間隔があります。
自分のコード
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSizeMake(self.view.frame.width/2 - 10, self.view.frame.width/2 - 10)
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat {
return 5
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAtIndex section: Int) -> CGFloat {
return 5
}
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)
}