Establishing Collection Views

As with tables, collections come in two flavors: views and prebuilt controllers. You either build an individual collection view instance and add it to a presentation or use a UICollectionViewController object that conveniently offers a view controller prepopulated with a collection view. The controller automatically sets the view’s data source delegate to itself and declares both protocols. Embed the collection view controller as a child of any container (such as a navigation controller, tab bar controller, split view controller, page view controller, and so on) or present it on its own.

Note

Like table views, collection views have delegate and dataSource properties. The UICollectionViewFlowLayout class expects ...

Get The Core iOS Developer’s Cookbook, Fifth 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.