Cleanup setup of default flow layout inspector

This commit is contained in:
Levi McCallum
2015-09-29 15:16:30 -07:00
parent 4c6585d3b3
commit a659ce7bf8

View File

@@ -205,10 +205,6 @@ static BOOL _isInterceptedSelector(SEL sel)
_dataController.delegate = _rangeController;
_dataController.dataSource = self;
_flowLayoutInspector = [[ASCollectionViewFlowLayoutInspector alloc] init];
// TODO: Implement a better path of falling-back to a flow layout
_flowLayoutInspector.layout = (UICollectionViewFlowLayout *)layout;
_batchContext = [[ASBatchContext alloc] init];
_leadingScreensForBatching = 1.0;
@@ -228,6 +224,15 @@ static BOOL _isInterceptedSelector(SEL sel)
// and should not trigger a relayout.
_ignoreMaxSizeChange = CGSizeEqualToSize(_maxSizeForNodesConstrainedSize, CGSizeZero);
// Register the default layout inspector delegate for flow layouts, custom layouts
// will need to roll their own ASCollectionViewLayoutInspecting implementation.
if ([layout asdk_isFlowLayout]) {
_flowLayoutInspector = [[ASCollectionViewFlowLayoutInspector alloc] init];
_flowLayoutInspector.layout = (UICollectionViewFlowLayout *)layout;
_flowLayoutInspector.collectionView = self;
_layoutDelegate = _flowLayoutInspector;
}
self.backgroundColor = [UIColor whiteColor];
[self registerClass:[_ASCollectionViewCell class] forCellWithReuseIdentifier:@"_ASCollectionViewCell"];