i'm doing with this, i want to use CollectionView, but i haven't seen prototype cell, and don't know how to use CollectionView in this case, can someone help me ?
I try to use like this way but it take alot of time and hard to manage than UICollectionView
The main way to use UICollectionView is by managing the logic programmatically.
First, create a new class which inherits from
UICollectionViewCell
. Choose if you want to include a xib to easily design your cell:Design your cell with Interface Builder or programmatically.
Create your main view controller including a xib (or a storyboard) with the collection view inside and link it to the associated class via Interface Builder. Alternatively you can add a collection view programmatically to your
UIViewController
Make the target view controller conform to the
UICollectionViewDelegate
andUICollectionViewDataSource
protocols by declaring them after the father class:Register the associated nib or the class for your cell in the
viewDidLoad
method and associate the datasource and delegate protocols to the view controller class:Implement the methods declared in the
UICollectionViewDelegate
andUICollectionViewDataSource
protocols :Run your app in the simulator (or on a real device) and.. Et voilà! :)
For more info: https://developer.apple.com/reference/uikit/uicollectionview