I have a simple UIViewController
and i want to place multiple UICollectionView
(more than one) into that UIViewController
programmatically.
I know this is entirely possible but i want to configure and implement the UICollectionView
in subclass.
And the question is:
- How can i init and add as subview
UICollectionView
in UIViewController
- What type should be my subclass
UICollectionView
or UICollectionViewController
P.S. I don't use Storyboard or Nib and i want to do this 100% programmatically.
Thanks in advance
Ptah :
It should look like this:\n\nlet controller = <your UICollectionViewController initialization>\naddChildViewController(controller)\ncontroller.view.frame = CGRectMake(...) //frame of UICollectionView you want it takes in main View\nview.addSubview(controller.view)\ncontroller.didMoveToParentViewController(self)\n\n\nBy the way, it is actually much easier if you use the \"Container view\" in Interface Builder. Then you don't have to worry about any of these containment-related calls, and Interface Builder will take care of it for you.",
2015-08-17T07:35:19