1121 - iOS之UICollectionViewLayoutAttributes类

UICollectionViewLayoutAttributes是布局对象用于管理集合视图中item的布局属性。它涉及声明、子类化建议、创建布局属性、标识引用项、访问布局属性等。在iOS 7及以后版本,只有当属性发生变化时,布局属性才会被应用。可通过子类化并实现isEqual:方法来添加自定义布局属性。
摘要由CSDN通过智能技术生成

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里面的,所以你可以通过实现

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值