Skip to content

Commit

Permalink
Remove cached layout attribute objects when collection view has 0 sec…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
dginsburg committed Mar 27, 2015
1 parent 025939f commit 5df9c02
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions CHTCollectionViewWaterfallLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ - (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) {
Expand All @@ -205,13 +212,6 @@ - (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];
Expand Down

0 comments on commit 5df9c02

Please sign in to comment.