-
Notifications
You must be signed in to change notification settings - Fork 40
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
[Question] Horizontal scroll #2
Comments
Hi! Yes, you would probably need to create nested groups to make the 3x3 grid for example and then you could set the The article in question for others: https://nemecek.be/blog/72/building-instagram-profile-screen-with-compositional-layout Btw, I am curious how did you find the article? :-) |
I'll take a look at it, thank you! Found your article in the mail subscription from here https://mbltdev.ru/en |
Interesting! Thanks for the info. Thinking about the photos.. I realized that you possibly don't even need nested groups. Below is slightly modified and untested code for the photos section if you want to try it out: func createPhotosSection() -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1/3),
heightDimension: .fractionalWidth(1))
let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 3)
let section = NSCollectionLayoutSection(group: group)
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(50))
let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
section.boundarySupplementaryItems = [header]
section.orthogonalScrollingBehavior = .continuous
return section
} Note that I made the group |
It aligns in the vertical direction but still scrolls in the horizontal direction... |
Hi @SMH-7 I am not sure I understand the question. I think you could use |
My default flowLayout was |
Hey, @nemecek-filip
Thanks for the article.
I recently faced a bit similar task but ended up resolving it without compositional layout.
So the question is, is there any possibility to have a horizontal scroll in the photos section (slice D from the article), so you scroll among tabs from the header?
The text was updated successfully, but these errors were encountered: