diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 21ff2a4a9..d53768d36 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -2017,7 +2017,13 @@ - (BOOL)dataController:(ASDataController *)dataController presentedSizeForElemen ASDisplayNodeFailAssert(@"Data controller should not ask for presented size for element that is not presented."); return YES; } - UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath]; + + UICollectionViewLayoutAttributes *attributes; + if (element.supplementaryElementKind == nil) { + attributes = [self layoutAttributesForItemAtIndexPath:indexPath]; + } else { + attributes = [self layoutAttributesForSupplementaryElementOfKind:element.supplementaryElementKind atIndexPath:indexPath]; + } return CGSizeEqualToSizeWithIn(attributes.size, size, FLT_EPSILON); }