collectionViewContentSize()vs contentSize [英] collectionViewContentSize() vs contentSize
问题描述
有什么区别
collectionViewController.collectionViewLayout.collectionViewContentSize()
和 collectionViewController.collectionView.contentSize
?
您更喜欢使用什么?
推荐答案
collectionViewContentSize()
是一种可以覆盖(在布局中)动态生成大小的方法。
collectionViewContentSize()
is a method you can override (in the layout) to generate the size dynamically.
contentSize
属于 collectionView
即将进行的属性如果没有这样的覆盖,则使用。
contentSize
is a property of collectionView
that is going to be used if there is no such override.
类似于 UITableView
的 rowHeight
与 UITableViewDelegate
的 heightForRowAtIndexPath()
。
另请注意(如评论中所述) contentSize
是 UIScrollView
-inherited属性,而 itemSize
是 UICollectionViewLayout
上的属性,允许您为每个单元格指定一个大小。
Please also note (as mentioned in the comments) that "contentSize
is a UIScrollView
-inherited property, while itemSize
is the property on UICollectionViewLayout
that allows you to specify a blanket size for each cell".
这篇关于collectionViewContentSize()vs contentSize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!