0

I am trying to populate the cells of a collection view without using a collection view controller. I want the View controller in which my collection view resides to be responsible for populating the cells with its content.

Any advise on how to approach this would be greatly appreciated.

Felix Hidalgo
  • 25
  • 1
  • 2

2 Answers2

0

All you need to do is add the delegate method to your UIViewController and link the UIViewController as the data Source in the NIB to to the UICollectionView. Here is an example:

@interface MainViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>

Hope this helps.

0
 myCollectionView.delegate = self;
 myCollectionView.dataSource = self;
matt
  • 447,615
  • 74
  • 748
  • 977