How to instantiate CollectionViewController
inside ViewController
and set CollectionViewControllers
view as subview of ViewController
? There is a catch with FlowLayout, but I can't find a solution.
I need functionality of same collectionView
in 2 separate viewControllers
. Because of that I want to create CollectionViewController
, that I can reuse with different properties, and assign its view to second ViewController
.
I'm not sure if you have already tried this as you didn't really put any code example or explain in detail what exactly your issue is but you can add the collectionViewController as a childViewController to your parentViewController.
yourCollectionViewController *yourName = [self.storyboard instantiateViewControllerWithIdentifier:@"YOUR_IDENTIFIER"];
//Add view to the container view tower
[self addChildViewController:yourName];
[self.view addSubview:yourName.view];
[yourName didMoveToParentViewController:self];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.