[英]Swift 3 manipulating UICollectionViewCell size?
I'm struggling with manipulating my UICollectionViewCell sizes, since it seem the function is deprecated, same goes for spacing. 我正在努力处理UICollectionViewCell的大小,因为似乎不赞成使用该函数,所以间距也一样。 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? 我应该在Swift 3中使用哪个功能?
you can try this code in swift3 您可以在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) }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.