Skip to content

UICollectionViewLayoutAttributes

UICollectionViewLayoutAttributes 用于描述 cell/supplementary/decoration 元素在布局中的几何与显示属性。它常作为 UICollectionViewUICollectionViewLayout 的查询返回值出现。

属性类型说明
invalidateEverythingboolean只读。表示一次失效是否影响所有布局。
invalidateDataSourceCountsboolean只读。表示数据源计数是否需要重新计算。
indexPathAfterUpdateNSIndexPath只读。更新后的 indexPath。
indexPathBeforeUpdateNSIndexPath只读。更新前的 indexPath。
collectionViewUICollectionView只读。所属 collectionView。
representedElementKindstring只读。元素 kind。
indexPathNSIndexPathindexPath。
frame{ x: number, y: number, width: number, height: number }frame。
bounds{ x: number, y: number, width: number, height: number }bounds。
size{ width: number, height: number }size。
center{ x: number, y: number }center。
transformobject二维仿射变换。
transform3Dobject三维变换。
alphanumber透明度。
hiddenboolean是否隐藏。
zIndexnumberzIndex。
方法参数返回值说明
layoutAttributesForCellWithIndexPath(indexPath)indexPath: NSIndexPathUICollectionViewLayoutAttributes创建 cell 的布局属性。
layoutAttributesForSupplementaryViewOfKindWithIndexPath(elementKind, indexPath)elementKind: string, indexPath: NSIndexPathUICollectionViewLayoutAttributes创建 supplementary view 的布局属性。
layoutAttributesForDecorationViewOfKindWithIndexPath(decorationViewKind, indexPath)decorationViewKind: string, indexPath: NSIndexPathUICollectionViewLayoutAttributes创建 decoration view 的布局属性。
头文件 API 清单

正在加载…

协议:,来源: