Reputation: 537
I'm currently wanna create an floating UICollectionView on screen which can change width whenever number of items inside it changed.
For example:
I'm prefer to make it with max width = 280px
If numberOfItems
= 2, my UICollectionView width will fit with items inside it, and it will increase width till numberOfItems
= 4, If numberOfItems
> 4, it's will enable scrolling horizontally.
Does someone has made it before? Please help me.
Thanks in advance.
edit: I'm updated image about the collection view, currently it's only have 2 items while width = 280.
Upvotes: 0
Views: 243
Reputation: 451
I think that is something you are looking for. Check out my test project to see how it works. You have to change width constraint only.
Upvotes: 1