- Set different layout for each section.
- (MHCollectionViewFlowLayoutType)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout layoutTypeForSectionAtIndex:(NSInteger)section;
- Current suport flow and water fall layout method.
typedef NS_ENUM(NSUInteger, MHCollectionViewFlowLayoutType) {
MHCollectionViewFlowLayoutTypeFlow,
MHCollectionViewFlowLayoutTypeWaterFall,
};
- Respect the exact line and interitem spacing you set versus the UIKit default behavior.
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout lineSpacingForSectionAtIndex:(NSInteger)section;
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout interitemSpacingForSectionAtIndex:(NSInteger)section;
For MHCollectionViewFlowLayoutTypeWaterFall layout, the number of columns and the width of each column is decided by the itemSize you returned by - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath; for the first row. Once the first row is fullfilled, the subsequent items' width you returned from the delegate method is ignored.
To run the example project, clone the repo, and run pod install from the Example directory first.
MHCollectionViewFlowLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MHCollectionViewFlowLayout', :git => 'git@github.com:Minghao2017/MHCollectionViewFlowLayout.git'薛明浩, xue_minghao@qq.com
MHCollectionViewFlowLayout is available under the MIT license. See the LICENSE file for more info.
