首页 > 其他 > 详细

两个线性布局的方法

时间:2016-01-21 23:25:09      阅读:200      评论:0      收藏:0      [点我收藏+]

- (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,才会有效果

两个线性布局的方法

原文:http://www.cnblogs.com/ritian/p/5149676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!