zoukankan      html  css  js  c++  java
  • 自定义layout中需要重写的方法

    Layout类中,有3个方法是必定会被依次调用:

    1. prepareLayout: 准备所有view的layoutAttribute信息

    2. collectionViewContentSize: 计算contentsize,显然这一步得在prepareLayout之后进行

    3. layoutAttributesForElementsInRect: 返回在可见区域的view的layoutAttribute信息,

      这个方法不写 集合视图显示不出来,这个方法是将保存的每个item的信息告诉集合视图,进行显示。

    此外,还有其他方法可能会被调用:

    - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath { } 
    - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { } 
    - (UICollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString *)decorationViewKind atIndexPath:(NSIndexPath *)indexPath { } 
    - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { }
  • 相关阅读:
    一次完整的HTTP事务的过程
    移动端事件
    canvas 在视频中的用法
    理解Vue
    改变console.log的输出样式
    百度下拉搜索案例
    Vue总结
    字符串、正则
    .Net Mvc框架知识点
    Lowest Common Ancestor of a Binary Tree -- LeetCode
  • 原文地址:https://www.cnblogs.com/dabaomo/p/5205417.html
Copyright © 2011-2022 走看看