JQCollectionViewWaterfallLayout 0.2.0

JQCollectionViewWaterfallLayout 0.2.0

coder zjq 维护。




  • coder-zjq

JQCollectionViewWaterfallLayout

Version License Platform

示例

要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install

方向 图像
UICollectionViewScrollDirectionVertical
UICollectionViewScrollDirectionHorizontal

要求

iOS 6.0+

安装

JQCollectionViewWaterfallLayout 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中

pod 'JQCollectionViewWaterfallLayout'

使用

使用方式与 UICollectionViewFlowLayout 相同。但请注意 UICollectionViewDelegateFlowLayout 协议方法 collectionView:layout:sizeForItemAtIndexPath:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    // When scroll direction is UICollectionViewScrollDirectionVertical, the item width is fixed, the item height is flexible. And you can change the col count by measure the item width.
    
    // When scroll direction is UICollectionViewScrollDirectionHorizontal, the item height is fixed, the item width is flexible. And you can change the row count by measure the item height.

}

(更多详情见 示例 项目)

作者

coder-zjq, [email protected]

许可证

JQCollectionViewWaterfallLayout 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。