collectionViewContentSize()vs contentSize [英] collectionViewContentSize() vs contentSize

查看:111
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆