Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionViewController doesn't abide by layoutMargins or top NSCollectionLayoutGroup.contentInsets #13

Closed
teradyl opened this issue Feb 23, 2021 · 2 comments

Comments

@teradyl
Copy link

teradyl commented Feb 23, 2021

I'm trying to inset my content in my CollectionViewController subclass, and I'm not sure how to do it.

First I tried updating the collectionView.layoutMargins, but that did nothing to how the cells are laid out. It seems like epoxy ignores the layoutMargins.

Second, I tried modifying my UICollectionViewCompositionalLayout and modified the group content insets as such:
group.contentInsets = .init(top: 20, leading: 20, bottom: 0, trailing: 20)
This seemed to work for the leading and trailing sides, but the top had no effect on pushing the first cell down.

Any insight on how to lower my top cell without adding a margin to the first cell itself?

@erichoracek
Copy link
Collaborator

Hi Dylan! I would recommend using the additionalSafeAreaInsets.top of the CollectionViewController to adjust the insets of the CollectionView within. This is how the bar installers work under the hood as well. It should allow you to inset the first cell.

@teradyl
Copy link
Author

teradyl commented Feb 24, 2021

Hi Eric! That's what I needed, thanks!

@teradyl teradyl closed this as completed Feb 24, 2021
@teradyl teradyl changed the title CollectionViewController doesn't abide by layoutMargins or top NSCollectionLayoutGroup.contentInsets or CollectionViewController doesn't abide by layoutMargins or top NSCollectionLayoutGroup.contentInsets Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants