Reputation: 413
I want to set offset offset for the first element of collectionView, so the first cell will apear in the center of the collectionView.
Upvotes: 0
Views: 5436
Reputation: 1026
Put this in your ViewDidLoad:
yourCollectionView.contentInset = UIEdgeInsets(top: 0, left: yourCollectionView.frame.width/2, bottom: 0, right: 0)
I hope this helps
Upvotes: 12
Reputation: 413
I did it with UIEdgeInsets. It can be set either in interface builder or in code by setting sectionInsets property of UICollectionViewFlowLayout
Upvotes: 0