netwire
netwire

Reputation: 7215

Grid-based UICollectionView on iOS 8 (Swift)

I'm trying to implement a UICollectionView that's grid-based, so that it looks something like this where every box is either a square or a rectangle. The number of items per row and the dimensions of each cell would differ based on screen size (i.e. iPhone 4, 5S, 6, iPad, etc.). This can be done using JavaScript: http://packery.metafizzy.co/ but I'd like to figure out how to do it using Swift. This would only need to work with iOS 8+ so I'm not sure if the native UICollectionView can do this already. Should I be implementing UICollectionViewFlowLayout?

enter image description here

Upvotes: 2

Views: 1253

Answers (1)

codester
codester

Reputation: 37189

No native Layouts will not provide this functionality.You have to extend UICollectionViewLayout and make custom Layout based on that

You can look this example and this example.It will help you.However it is in objective-c

Upvotes: 3

Related Questions