UICollectionViewController nested in a normal UIViewController
- by patrickS
I have added a UICollectionView into a normal ViewController (MainViewController), and than created a UICollectionViewController Subclass (CollectionViewController) in the ViewController and connected the UICollectionView outlet with the CollectionViewController object
_collectionViewController = [[CollectionViewController alloc] initWithCollectionViewLayout:_collectionView.collectionViewLayout];
_collectionView.dataSource = _collectionViewController;
_collectionView.delegate = _collectionViewController;
In the CollectionViewController I have setup an simple NSArray object and I show this one. This works as expected. But If I try to access the collectionview from the CollectionViewController via self.collectionview I am not able to access this one.
I dont know what I have to do, to also connect the collectionview.
I have build a sample ios-app it is available at: https://github.com/patricks/uicollectionview-problem
The method - (void)outputSelectedCell in the UICollectionViewController always shows, that there is nothing selected…
I hope you understand the problem.