Introducing Collection Views

A collection view needs a few different classes in order to work. The base class is called UICollectionView and is a subclass of UIScrollView. It will manage the presentation of cells provided by the datasource (which can be any class implementing the UICollectionViewDataSource protocol), according to the layout referenced by the collection view, which will be an instance of UICollectionViewLayout. A delegate conforming to the UICollectionViewDelegate protocol can be specified to manage selection and highlighting of cells.

The class that conforms to the UICollectionViewDataSource protocol will return configured cells to the collection view, which will be instances of UICollectionViewCell. If the collection view is ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.