I just started learning about UICollectionViews. I’m wondering if anyone knows how to specify the number of columns in a collectionview. The default is set to 3 (iPhone/portrait). I’ve looked at the documentation and can’t seem to find a concise answer.
I just started learning about UICollectionViews. I’m wondering if anyone knows how to specify
Share
CollectionViews are very powerful, and they come at a price. Lots, and lots of options. As omz said:
I’d suggest implementing the
<UICollectionViewDelegateFlowLayout>Protocol, giving you access to the following methods in which you can have greater control over the layout of yourUICollectionView, without the need for subclassing it:collectionView:layout:insetForSectionAtIndex:collectionView:layout:minimumInteritemSpacingForSectionAtIndex:collectionView:layout:minimumLineSpacingForSectionAtIndex:collectionView:layout:referenceSizeForFooterInSection:collectionView:layout:referenceSizeForHeaderInSection:collectionView:layout:sizeForItemAtIndexPath:Also, implementing the following method will force your UICollectionView to update it’s layout on an orientation change: (say you wanted to re-size the cells for landscape and make them stretch)
Additionally, here are 2 really good tutorials on
UICollectionViews:http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
http://skeuo.com/uicollectionview-custom-layout-tutorial