Reputation: 485
Normaly, if we want to use UICollectionView
, we must use an UICollectionViewController
. But now I don't want, so how can I use UICollectionView
without an UICollectionViewController
?
Upvotes: 1
Views: 2237
Reputation: 912
Of course you can use a UICollectionView
without an UICollectionViewController
.
Just create a UICollectionViewLayout
of your choice, and then call
- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
to create a new instance of UICollectionView
. Don't forget to set the delegate and datasource of the UICollectionView
to your class, and implement the UICollectionViewDataSource
protocol.
Hope that helps.
Upvotes: 3