O'Reilly logo

Mastering iOS 10 Programming by Donny Wals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding the UICollectionViewFlowLayout and its delegate

The layout that UICollectionView provides out of the box is a grid layout. All items are evenly spaced and sized. To visualize this, open up the storyboard file, select the cell, give it a background color, and run the app. This will make the grid layout really obvious, and it also shows how the constraints nicely center the UI elements inside of the cell.

The ease of use and the performance of the UICollectionView make this a great way for your app to use a grid layout. However, the current implementation of the grid is not perfect yet. The grid looks alright on an iPhone 6s; but on an iPhone SE, the layout looks like it's falling apart and it doesn't look much better when viewed on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required