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

CollectionView in Row? #16

Closed
shokaveli opened this issue Nov 5, 2018 · 2 comments
Closed

CollectionView in Row? #16

shokaveli opened this issue Nov 5, 2018 · 2 comments
Assignees

Comments

@shokaveli
Copy link

Is this possible to do? I tried it and could not get the collectionview to display.

@shokaveli shokaveli changed the title CollectionView in Cell? CollectionView in Row? Nov 5, 2018
@shokaveli
Copy link
Author

so i managed to get a collectionview to display by setting a height constraint but when i tap on the cells inside it the whole thing disappears.

@marlimox
Copy link
Owner

marlimox commented Nov 7, 2018

Hi @shokaveli, thanks for your interest in AloeStackView.

Displaying a UICollectionView as a row in an AloeStackView is not supported out-of-the-box. One issue is that UICollectionView is also UIScrollView, just like AloeStackView is. Hence, adding one as a row will result in nested UIScrollViews that scroll in the same direction, which is something that is generally not supported by UIKit.

Another issue is that UICollectionView does not self-size to its contents, so AloeStackView (which just uses UIStackView under the hood) will not know how to size the row. As you discovered, you can work around this by giving it a fixed height constraint, but this won’t be based on the content it’s displaying so you’ll likely run into problems making it the correct height you want across devices (not to mention other issues you’ll run into getting it to display correctly).

In this case, you’re probably better off laying out the views inside the collection view manually inside their own view and adding that as a row, or not using AloeStackView and just using the collection view by itself.

Let me know if I can answer any more questions specific to AloeStackView!

@marlimox marlimox closed this as completed Nov 7, 2018
@marlimox marlimox self-assigned this Nov 7, 2018
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