mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Handle initial sizing delegate implementation in flow layout inspector
This commit is contained in:
@@ -19,11 +19,25 @@
|
||||
|
||||
#pragma mark - Accessors
|
||||
|
||||
- (void)setLayout:(UICollectionViewFlowLayout *)layout
|
||||
- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView flowLayout:(UICollectionViewFlowLayout *)flowLayout
|
||||
{
|
||||
_layout = layout;
|
||||
_delegateImplementsReferenceSizeForHeader = [[self layoutDelegate] respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)];
|
||||
_delegateImplementsReferenceSizeForFooter = [[self layoutDelegate] respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)];
|
||||
if (flowLayout == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
self.collectionView = collectionView;
|
||||
_layout = flowLayout;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setCollectionView:(ASCollectionView *)collectionView
|
||||
{
|
||||
_collectionView = collectionView;
|
||||
_delegateImplementsReferenceSizeForHeader = [[self layoutDelegate] respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)];
|
||||
_delegateImplementsReferenceSizeForFooter = [[self layoutDelegate] respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)];
|
||||
}
|
||||
|
||||
#pragma mark - ASCollectionViewLayoutInspecting
|
||||
@@ -94,9 +108,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (id<UICollectionViewDelegateFlowLayout>)layoutDelegate
|
||||
- (id<ASCollectionViewDelegateFlowLayout>)layoutDelegate
|
||||
{
|
||||
return (id<UICollectionViewDelegateFlowLayout>)self.collectionView.delegate;
|
||||
return (id<ASCollectionViewDelegateFlowLayout>)_collectionView.asyncDelegate;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user