Skip to content

UICollectionView waterfall layout.(UICollectionView 瀑布流布局)

License

Notifications You must be signed in to change notification settings

tongyuling/JQCollectionViewWaterfallLayout

 
 

Repository files navigation

JQCollectionViewWaterfallLayout

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Direction Image
UICollectionViewScrollDirectionVertical
UICollectionViewScrollDirectionHorizontal

Feature

  • vertical and horizontal scroll direction;
  • different row/col count with different section;
  • section headerView and footerView;
  • contentInset of collectionView;
  • inset for section;
  • updates of UICollectionView cells;
  • same usage as UICollectionViewFlowLayout.

Requirements

iOS 6.0+

Installation

JQCollectionViewWaterfallLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JQCollectionViewWaterfallLayout'

Usage

Same usage as UICollectionViewFlowLayout. But you should pay attention to the UICollectionViewDelegateFlowLayout protocol method 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.

}

(see more detail in Example Project)

Author

coder-zjq, [email protected]

License

JQCollectionViewWaterfallLayout is available under the MIT license. See the LICENSE file for more info.

About

UICollectionView waterfall layout.(UICollectionView 瀑布流布局)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C++ 50.6%
  • Objective-C 42.1%
  • Ruby 7.3%