From 60ed2bca474f9597c90a842386ba9043af6acf0b Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Wed, 5 Aug 2015 17:33:53 +0300 Subject: [PATCH] Fix _implementsInsetSection of ASCollectionView being check before the asyncDelegate is set. --- AsyncDisplayKit/ASCollectionView.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index b5b132dca8..8a0b73ffba 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -166,8 +166,6 @@ static BOOL _isInterceptedSelector(SEL sel) _performingBatchUpdates = NO; _batchUpdateBlocks = [NSMutableArray array]; - _implementsInsetSection = ([_asyncDelegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)] ? 1 : 0); - [self registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"_ASCollectionViewCell"]; return self; @@ -244,10 +242,12 @@ static BOOL _isInterceptedSelector(SEL sel) super.delegate = nil; _asyncDelegate = nil; _proxyDelegate = nil; + _implementsInsetSection = NO; } else { _asyncDelegate = asyncDelegate; _proxyDelegate = [[_ASCollectionViewProxy alloc] initWithTarget:_asyncDelegate interceptor:self]; super.delegate = (id)_proxyDelegate; + _implementsInsetSection = ([_asyncDelegate respondsToSelector:@selector(collectionView:layout:insetForSectionAtIndex:)] ? 1 : 0); } }