diff --git a/CHTCollectionViewWaterfallLayout.m b/CHTCollectionViewWaterfallLayout.m index 1a5bd12..b207789 100644 --- a/CHTCollectionViewWaterfallLayout.m +++ b/CHTCollectionViewWaterfallLayout.m @@ -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++) { @@ -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; @@ -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; }