0
私はので、私は次のコードを書いた中央にあることがUICollectionViewの項目を望んでいた:設定UICollectionViewのUIEdgeInsets
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
let collectionViewWidth = collectionView.bounds.width
let collectionViewHeight = collectionView.bounds.height
let numberOfRows = CGFloat(collectionView.numberOfItemsInSection(0))
let leftValue = (collectionViewWidth/2.0) - (numberOfRows * 5) - (numberOfRows * (collectionViewHeight/2.0))
print(leftValue)
return UIEdgeInsets(top: 0, left: leftValue, bottom: 0, right: 0)
}
をしかし、今の問題は、私の左のインセットは、してください変更として、私は左にそれをスクロールすることができないです何か解決策を提案してください。