Skip to content

Commit e4a5021

Browse files
Merge pull request #56 from notjosh/bug/trailing-vs-leading
Fix incorrect insets for sections
2 parents 61da20c + f116b7c commit e4a5021

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

IBPCollectionViewCompositionalLayout/IBPUICollectionViewCompositionalLayout.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,11 @@ - (void)prepareLayout {
294294
decorationViewFrame.origin = sectionOrigin;
295295

296296
if (self.scrollDirection == UICollectionViewScrollDirectionVertical) {
297-
decorationViewFrame.size.width += CGRectGetWidth(contentFrame) + layoutSection.contentInsets.leading;
298-
decorationViewFrame.size.height = CGRectGetMaxY(contentFrame) - sectionOrigin.y + layoutSection.contentInsets.top;
297+
decorationViewFrame.size.width += CGRectGetWidth(contentFrame);
298+
decorationViewFrame.size.height = CGRectGetMaxY(contentFrame) - sectionOrigin.y + layoutSection.contentInsets.bottom;
299299
}
300300
if (self.scrollDirection == UICollectionViewScrollDirectionHorizontal) {
301-
decorationViewFrame.size.width = CGRectGetMaxX(contentFrame) - sectionOrigin.x;
301+
decorationViewFrame.size.width = CGRectGetMaxX(contentFrame) - sectionOrigin.x + layoutSection.contentInsets.trailing;
302302
decorationViewFrame.size.height += CGRectGetHeight(contentFrame);
303303
}
304304

0 commit comments

Comments
 (0)