When you use a standard collection view, it uses a grid layout. In this grid layout, all items are evenly spaced, and all items have the same size. You can visualize this quite easily by giving the collection view cell a background color in your Storyboard and running your app. This standard grid layout makes adding a grid to your app a breeze. However, the standard implementation of the grid layout is not quite perfect. If you look at the grid you have set up, it should look good on, for instance, an iPhone 8 but when switching to a smaller screen such as the iPhone SE, the layout looks nothing like the beautiful grid layout you saw before. Viewing the grid on a larger screen such ...
Understanding UICollectionViewFlowLayout and its delegate
Get Mastering iOS 12 Programming - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.