From 8854fbd9c1287bf1de6eb9e9a4ace379e1870fee Mon Sep 17 00:00:00 2001 From: Nelson Date: Sun, 12 Apr 2015 21:58:45 +0800 Subject: [PATCH] Revert "Remove cached layout attribute objects when collection view has 0 sectio..." --- CHTCollectionViewWaterfallLayout.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CHTCollectionViewWaterfallLayout.m b/CHTCollectionViewWaterfallLayout.m index e1ce651..194659f 100644 --- a/CHTCollectionViewWaterfallLayout.m +++ b/CHTCollectionViewWaterfallLayout.m @@ -193,13 +193,6 @@ - (id)initWithCoder:(NSCoder *)aDecoder { #pragma mark - Methods to Override - (void)prepareLayout { [super prepareLayout]; - - [self.headersAttribute removeAllObjects]; - [self.footersAttribute removeAllObjects]; - [self.unionRects removeAllObjects]; - [self.columnHeights removeAllObjects]; - [self.allItemAttributes removeAllObjects]; - [self.sectionItemAttributes removeAllObjects]; NSInteger numberOfSections = [self.collectionView numberOfSections]; if (numberOfSections == 0) { @@ -212,6 +205,13 @@ - (void)prepareLayout { // Initialize variables NSInteger idx = 0; + [self.headersAttribute removeAllObjects]; + [self.footersAttribute removeAllObjects]; + [self.unionRects removeAllObjects]; + [self.columnHeights removeAllObjects]; + [self.allItemAttributes removeAllObjects]; + [self.sectionItemAttributes removeAllObjects]; + for (NSInteger section = 0; section < numberOfSections; section++) { NSInteger columnCount = [self columnCountForSection:section]; NSMutableArray *sectionColumnHeights = [NSMutableArray arrayWithCapacity:columnCount];