Skip to content

Commit

Permalink
Merge pull request #177 from chiahsien/revert-175-master
Browse files Browse the repository at this point in the history
Revert "separation footer and header "
  • Loading branch information
chiahsien authored Jun 28, 2017
2 parents 1926c84 + 45138ab commit 7186ee6
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions CHTCollectionViewWaterfallLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSInteger i;
NSInteger begin = 0, end = self.unionRects.count;
NSMutableDictionary *cellAttrDict = [NSMutableDictionary dictionary];
NSMutableDictionary *supplHeaderAttrDict = [NSMutableDictionary dictionary];
NSMutableDictionary *supplFooterAttrDict = [NSMutableDictionary dictionary];
NSMutableDictionary *supplAttrDict = [NSMutableDictionary dictionary];
NSMutableDictionary *decorAttrDict = [NSMutableDictionary dictionary];

for (i = 0; i < self.unionRects.count; i++) {
Expand All @@ -449,11 +448,7 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
if (CGRectIntersectsRect(rect, attr.frame)) {
switch (attr.representedElementCategory) {
case UICollectionElementCategorySupplementaryView:
if ([attr.representedElementKind isEqualToString:CHTCollectionElementKindSectionHeader]) {
supplHeaderAttrDict[attr.indexPath] = attr;
} else if ([attr.representedElementKind isEqualToString:CHTCollectionElementKindSectionFooter]) {
supplFooterAttrDict[attr.indexPath] = attr;
}
supplAttrDict[attr.indexPath] = attr;
break;
case UICollectionElementCategoryDecorationView:
decorAttrDict[attr.indexPath] = attr;
Expand All @@ -465,8 +460,7 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
}
}

NSArray *result = [cellAttrDict.allValues arrayByAddingObjectsFromArray:supplHeaderAttrDict.allValues];
result = [result arrayByAddingObjectsFromArray:supplFooterAttrDict.allValues];
NSArray *result = [cellAttrDict.allValues arrayByAddingObjectsFromArray:supplAttrDict.allValues];
result = [result arrayByAddingObjectsFromArray:decorAttrDict.allValues];
return result;
}
Expand Down

0 comments on commit 7186ee6

Please sign in to comment.