kishikawakatsumi / IBPCollectionViewCompositionalLayout

Backport of UICollectionViewCompositionalLayout to earlier iOS 12
MIT License
1.55k stars 148 forks source link

Trailing section inset on orthogonal views #84

Closed notjosh closed 5 years ago

notjosh commented 5 years ago

~(Cherry-picked #80 so the example builds)~ rebased! 💅

Part of #78.

Adds the section insets to the end of an orthogonal view in the direction it scrolls.

I didn't spend time checking why the vertical insets aren't applied - I don't think it's the same thing as here, but it's related.

Before:

image

After:

image

iOS 13 reference:

image
notjosh commented 5 years ago

I didn't spend time checking why the vertical insets aren't applied - I don't think it's the same thing as here, but it's related.

Ah, this seems like it could be fixed here: IBPUICollectionViewCompositionalLayout.m#L236, updating it to:

- frame.size.width = CGRectGetWidth(cellFrame);
+ frame.size.width = CGRectGetWidth(cellFrame) + layoutItem.contentInsets.trailing;
kishikawakatsumi commented 5 years ago

I think section insets should be added in processing sections, not items. This PR is superseded by https://github.com/kishikawakatsumi/IBPCollectionViewCompositionalLayout/pull/85

kishikawakatsumi commented 5 years ago

Thank you for reporting. It is very helpful to fix the issue 😄