Views

To create a collection view for embedding into another view (without using a UICollectionViewController), establish a layout, create the collection view using the layout, and set the data source and delegate. The flow layout delegate utilizes the object you set as the collection view’s delegate property:

UICollectionViewFlowLayout *layout =     [[UICollectionViewFlowLayout alloc] init]; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero     collectionViewLayout:layout]; collectionView.dataSource = self; collectionView.delegate = self;

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.