I have a UICollectionView with a segmented control to switch between data. But how do I change the UICollectionViewCell size propertie
Swift 3
Methods from @sumit-oberoi answer won't be called if you are using Swift 3. To make it work make this adjustments:
Conform to the UICollectionViewDelegateFlowLayout protocol.
Implement these methods:
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
}
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 1.0
}
func collectionView(_ collectionView: UICollectionView, layout
collectionViewLayout: UICollectionViewLayout,
minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 1.0
}
Notice the changes:
_ before collectionView in the method nameNSIndexPath changes to IndexPath