user2684768
user2684768

Reputation: 33

How do I add CollectionViewController into ViewController

Based on the SimpleCollectionView sample, I have successfully add CollectionViewController into ViewController but I get an error when I clicked on the items in the CollectionViewController. Below are the codes for references.

UICollectionViewController simpleCollectionViewController;

public override void ViewDidLoad()
{
    base.ViewDidLoad();
    simpleCollectionViewController = new SimpleCollectionViewController(new LineLayout());
    View.AddSubView(simpleCollectionViewController.View);
}

Really hope someone willing to guide me on this.

Upvotes: 3

Views: 78

Answers (1)

michael
michael

Reputation: 81

That is because your controller has been released just try this

//self is the base controller
[self addChildViewController: simpleCollectionViewController];

Upvotes: 1

Related Questions