Search code examples
iosstoryboarduicollectionviewchildviews

iOS add a CollectionView to a another view within the storyboard UI builder


Just getting started with iOS, and trying to make the collection view on the right be a child view of the view on the left. I cant seem to drag it in. I think part of the problem is that on the left hand part of the nav (immediate left of the work area) the collection view is being called a scene. To create the view into which I want to put the collection view, I just dragged a new view controller into the work area, then did the control+click to add it to the main tab view. I am going to want another view above the collection view, but first things first...

Do I have to do this programmatically?

enter image description here


Solution

  • UICollectionView inherent from UIScrollView:UIView, so you can add in your IB or in code:

    Like tableView, drag delegate and datasource to ViewController.If you want more collectiotionView, create more flowlayouts.