From 380cd52ae247b7acc02c57dbf9c2339cee220599 Mon Sep 17 00:00:00 2001 From: Nelson Tai Date: Wed, 24 May 2017 22:25:18 +0800 Subject: [PATCH 1/4] Update podspec --- CHTCollectionViewWaterfallLayout.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHTCollectionViewWaterfallLayout.podspec b/CHTCollectionViewWaterfallLayout.podspec index 161c8a3..4260419 100644 --- a/CHTCollectionViewWaterfallLayout.podspec +++ b/CHTCollectionViewWaterfallLayout.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CHTCollectionViewWaterfallLayout" - s.version = "0.9.5" + s.version = "0.9.6" s.summary = "The waterfall (i.e., Pinterest-like) layout for UICollectionView." s.homepage = "https://github.com/chiahsien/CHTCollectionViewWaterfallLayout" s.screenshots = "https://raw.github.com/chiahsien/UICollectionViewWaterfallLayout/master/Screenshots/2-columns.png" From 9fa7d9e76c339cc280af4315e65a58859de5dea7 Mon Sep 17 00:00:00 2001 From: YYDD <615689375@qq.com> Date: Sat, 27 May 2017 09:47:37 +0800 Subject: [PATCH 2/4] update the demo show for release more easy --- Demo/Objective-C/Demo/CHTCollectionViewWaterfallCell.m | 3 ++- Demo/Objective-C/Demo/ViewController.m | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Demo/Objective-C/Demo/CHTCollectionViewWaterfallCell.m b/Demo/Objective-C/Demo/CHTCollectionViewWaterfallCell.m index c53ff9d..7c18cee 100644 --- a/Demo/Objective-C/Demo/CHTCollectionViewWaterfallCell.m +++ b/Demo/Objective-C/Demo/CHTCollectionViewWaterfallCell.m @@ -15,7 +15,8 @@ - (UIImageView *)imageView { if (!_imageView) { _imageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds]; _imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - _imageView.contentMode = UIViewContentModeScaleAspectFit; + _imageView.contentMode = UIViewContentModeScaleAspectFill; + [_imageView.layer setMasksToBounds:YES]; } return _imageView; } diff --git a/Demo/Objective-C/Demo/ViewController.m b/Demo/Objective-C/Demo/ViewController.m index 4ff41b9..6f87ea1 100644 --- a/Demo/Objective-C/Demo/ViewController.m +++ b/Demo/Objective-C/Demo/ViewController.m @@ -55,7 +55,7 @@ - (UICollectionView *)collectionView { - (NSArray *)cellSizes { if (!_cellSizes) { _cellSizes = @[ - [NSValue valueWithCGSize:CGSizeMake(400, 550)], + [NSValue valueWithCGSize:CGSizeMake(550, 550)], [NSValue valueWithCGSize:CGSizeMake(1000, 665)], [NSValue valueWithCGSize:CGSizeMake(1024, 689)], [NSValue valueWithCGSize:CGSizeMake(640, 427)] From c9cd67b30559f4dcadc8270eedccf6406df8d56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A1rdenas?= Date: Thu, 22 Jun 2017 14:00:09 -0500 Subject: [PATCH 3/4] Support simultaneous headers and footers --- CHTCollectionViewWaterfallLayout.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CHTCollectionViewWaterfallLayout.m b/CHTCollectionViewWaterfallLayout.m index b207789..1a5bd12 100644 --- a/CHTCollectionViewWaterfallLayout.m +++ b/CHTCollectionViewWaterfallLayout.m @@ -428,7 +428,8 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { NSInteger i; NSInteger begin = 0, end = self.unionRects.count; NSMutableDictionary *cellAttrDict = [NSMutableDictionary dictionary]; - NSMutableDictionary *supplAttrDict = [NSMutableDictionary dictionary]; + NSMutableDictionary *supplHeaderAttrDict = [NSMutableDictionary dictionary]; + NSMutableDictionary *supplFooterAttrDict = [NSMutableDictionary dictionary]; NSMutableDictionary *decorAttrDict = [NSMutableDictionary dictionary]; for (i = 0; i < self.unionRects.count; i++) { @@ -448,7 +449,11 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { if (CGRectIntersectsRect(rect, attr.frame)) { switch (attr.representedElementCategory) { case UICollectionElementCategorySupplementaryView: - supplAttrDict[attr.indexPath] = attr; + if ([attr.representedElementKind isEqualToString:CHTCollectionElementKindSectionHeader]) { + supplHeaderAttrDict[attr.indexPath] = attr; + } else if ([attr.representedElementKind isEqualToString:CHTCollectionElementKindSectionFooter]) { + supplFooterAttrDict[attr.indexPath] = attr; + } break; case UICollectionElementCategoryDecorationView: decorAttrDict[attr.indexPath] = attr; @@ -460,7 +465,8 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { } } - NSArray *result = [cellAttrDict.allValues arrayByAddingObjectsFromArray:supplAttrDict.allValues]; + NSArray *result = [cellAttrDict.allValues arrayByAddingObjectsFromArray:supplHeaderAttrDict.allValues]; + result = [result arrayByAddingObjectsFromArray:supplFooterAttrDict.allValues]; result = [result arrayByAddingObjectsFromArray:decorAttrDict.allValues]; return result; } From 179fabd231701894b590c0372292a2960be5c8c9 Mon Sep 17 00:00:00 2001 From: Nelson Tai Date: Tue, 5 Sep 2017 23:20:11 +0800 Subject: [PATCH 4/4] Update podspec --- CHTCollectionViewWaterfallLayout.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHTCollectionViewWaterfallLayout.podspec b/CHTCollectionViewWaterfallLayout.podspec index 4260419..7dc3ec5 100644 --- a/CHTCollectionViewWaterfallLayout.podspec +++ b/CHTCollectionViewWaterfallLayout.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CHTCollectionViewWaterfallLayout" - s.version = "0.9.6" + s.version = "0.9.7" s.summary = "The waterfall (i.e., Pinterest-like) layout for UICollectionView." s.homepage = "https://github.com/chiahsien/CHTCollectionViewWaterfallLayout" s.screenshots = "https://raw.github.com/chiahsien/UICollectionViewWaterfallLayout/master/Screenshots/2-columns.png"