I'm struggling with manipulating my UICollectionViewCell sizes, since it seem the function is deprecated, same goes for spacing. I've tried with this one:
func collectionView(collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: 150, height: 150)
}
Which function am I supposed to use in Swift 3?
you can try this code in swift3
override var collectionViewContentSize: CGSize {
return CGSize(width: 150, height: 150)
}
You can use below delegate method.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: 100, height: 100) }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.