zoukankan      html  css  js  c++  java
  • 两个线性布局的方法

    - (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect

    这个方法用来设置rect范围内所有的item的属性值

    UICollectionViewLayoutAttributes:用来表示任意一个item属性

    - (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity

    这个方法用来表示,当collectionview滚动的时候,本来停止滚动的时候,item最终停留的位置

    @param proposedContentOffset 用来表示,本来停止滚动时候的偏移量位置

    @param velocity              滚动的时候使用的力度

    @return 返回最终停留的位置

    - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds

    用来设置当现实的bounds(显示视图方位发生了变化)就会刷新布局,

    重写调用layoutAttributesForElementsInRect,来设置每一属性的值,返回值设置为yes,才会有效果

  • 相关阅读:
    第五章4
    第五章3
    第五章2
    第五章1
    第四章14
    第四章13
    第四章12
    第四章11
    第五章例5-6
    第五章例5-4
  • 原文地址:https://www.cnblogs.com/ritian/p/5149676.html
Copyright © 2011-2022 走看看