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

Is there a way to set the space between cells? #74

Closed
junweimah opened this issue Feb 9, 2018 · 3 comments
Closed

Is there a way to set the space between cells? #74

junweimah opened this issue Feb 9, 2018 · 3 comments
Labels

Comments

@junweimah
Copy link

I got the collection view up and running, but my project need to have the cells to be closer to each other, how do I set the space in between the cells?

Thanks.

@VasileiosDiamantidis
Copy link

On class PageCollectionLayout on PageCollectionLayout there is a function

fileprivate func commonInit(_ itemSize: CGSize) {
scrollDirection = .horizontal
minimumLineSpacing = 25
self.itemSize = itemSize
}

change the minimumLineSpacing as much as you want

@junweimah
Copy link
Author

what if i want to dynamically change the spacing to fit all different screen size? How do I do it?

@VasileiosDiamantidis
Copy link

VasileiosDiamantidis commented Mar 1, 2018

Instead of saying something like 25 you can take UIScreen bounds and divide to as much as you want for example if you want 1/10 of the screen spacing UIScreen.main.bounds.width / 10
If you can't access it from the library pass it as a variable from viewdidload() on your view controller and set it inside the function

@Juriv Juriv closed this as completed May 15, 2018
@Juriv Juriv added the question label May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants