Prevent calling unsupported UICollectionViewDelegate methods (supplementary view appearance)

This commit is contained in:
Scott Goodson 2015-12-31 00:21:20 -08:00
parent 0636ec44ed
commit df9f433353
4 changed files with 14 additions and 9 deletions

View File

@ -63,13 +63,6 @@
return self;
}
//- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
//{
// _viewControllerNode.frame = (CGRect){{0,0}, constrainedSize.max};
// NSLog(@"%f %f", constrainedSize.max.width, constrainedSize.max.height);
// return [super layoutSpecThatFits:constrainedSize];
//}
- (void)layout
{
[super layout];

View File

@ -944,6 +944,16 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
ASDisplayNodeAssert(![self.asyncDataSource respondsToSelector:_cmd], @"%@ is not supported by ASCollectionView - please remove or disable this data source method.", NSStringFromSelector(_cmd));
}
- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
{
ASDisplayNodeAssert(![self.asyncDataSource respondsToSelector:_cmd], @"%@ is not supported by ASCollectionView - please remove or disable this delegate method.", NSStringFromSelector(_cmd));
}
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
{
ASDisplayNodeAssert(![self.asyncDataSource respondsToSelector:_cmd], @"%@ is not supported by ASCollectionView - please remove or disable this delegate method.", NSStringFromSelector(_cmd));
}
#endif
@end

View File

@ -58,7 +58,9 @@
// intercepted due to not being supported by ASCollectionView (prevent bugs caused by usage)
selector == @selector(collectionView:canMoveItemAtIndexPath:) ||
selector == @selector(collectionView:moveItemAtIndexPath:toIndexPath:)
selector == @selector(collectionView:moveItemAtIndexPath:toIndexPath:) ||
selector == @selector(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:) ||
selector == @selector(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)
);
}

View File

@ -54,7 +54,7 @@ static NSUInteger kNumberOfImages = 14;
_layoutInspector = [[MosaicCollectionViewLayoutInspector alloc] init];
_collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout asyncDataFetching:YES];
_collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.asyncDataSource = self;
_collectionView.asyncDelegate = self;
_collectionView.layoutInspector = _layoutInspector;