Class
UICollectionViewLayoutAttributes
--A layout object that manages the layout-related attributes for a given item in a collection view.
这是一个布局对象,用于管理给定item的与布局相关的特征,主要是作用于cell的布局相关信息,全部或者某个cell的
Declaration -- 声明
class UICollectionViewLayoutAttributes : NSObject -- 直接继承与NSObject
Overview -- 概览
--Layout objects create instances of this class when asked to do so by the collection view. In turn, the collection view uses the layout information to position cells and supplementary views inside its bounds.
当collection view需要布局信息时,就会创建UICollectionViewLayoutAttributes的实例,然后collection view就根据这些布局信息来放置cell位置。
Subclassing Notes -- 子类化建议
--In most cases, you use this class as-is. If you want to supplement the base layout attributes with custom layout attributes, you can subclass and define whatever properties you want to store the additional layout data.
大多数情况下你可以直接使用该类的实例,但是也可以子类化该类,补充一些自定义的布局特征。
--Because layout attribute objects may be copied by the collection view, make sure your subclass conforms to the NSCopying
protocol by implementing any methods appropriate for copying your custom attributes to new instances of your subclass.
子类化的布局特征类,需要实现NSCopying
协议里面的方法。因为布局特征是被复制到collection view里面的,所以你可以通过实现