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

How to remove the initial space #36

Open
milap-eww opened this issue Jun 14, 2018 · 11 comments
Open

How to remove the initial space #36

milap-eww opened this issue Jun 14, 2018 · 11 comments

Comments

@milap-eww
Copy link

simulator screen shot - iphone 8 plus - 2018-06-14 at 15 46 34

@andre991
Copy link
Contributor

andre991 commented Oct 5, 2018

Hi @milap-eww could you remove this space?

@jpghelfi
Copy link

jpghelfi commented Nov 2, 2018

Need the same!!

@paskalem
Copy link

paskalem commented Nov 2, 2018 via email

@jpghelfi
Copy link

jpghelfi commented Nov 2, 2018

Yeap! I use a vertical flow, but the it's the same issue/request. I need to remove the initial spacing at the top of the collection. Any thoughts?

image

@suraj-ios
Copy link

@ALL,

let layout = UPCarouselFlowLayout()
layout.itemSize = CGSize(width:UIScreen.main.bounds.size.width - 80, height:UIScreen.main.bounds.size.width - 80)
layout.spacingMode = UPCarouselFlowLayoutSpacingMode.fixed(spacing: 10.0)
self.collectionView.collectionViewLayout = layout
self.rotationDidChange()

Remove space between two cell.

@andre991
Copy link
Contributor

@suraj-ios The problem is not this, the problem
is that in the first cell it has a large space between the margin and the cell, when we scroll in the collection it returns to the expected state.

@rudrankriyam
Copy link

If anyone has been able to solve it, please help. Thanks!

@rudrankriyam
Copy link

For vertical spacing, I was able to solve it by adding this -
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { return UIEdgeInsets(top: 2, left: 0, bottom: 0, right: 0) }

@jonasz-baron
Copy link

For me what helped was setting the itemSize after layout was properly defined, so in a view controller you could write in viewDidLayoutSubviews something like:
layout.itemSize = CGSize(width: view.frame.width, height: someHeight)
for horizontal scrolling.

@JiteshBharadiya
Copy link

@ALL

Try this,
It worked for me

let indexPath = IndexPath(row: 2, section: 0)
collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .centeredHorizontally)

@ahhhv
Copy link

ahhhv commented Aug 19, 2022

for me was change the edge inset left to my desired value in method updateLayout

sectionInset = UIEdgeInsets(top: yInset, left: 20, bottom: yInset, right: xInset)

hope it helps someone! cheers!

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

9 participants