Chris Edwards
Chris Edwards

Reputation: 3602

Accessing parent from UICollectionViewCell

I have a UIView (it's actually a PM::Screen) and am adding a subView which is a UICollectionViewController's view. I'm using this technique to switch between things like grid/list ala the Instagram profile screen.

Selecting a cell should open a new screen, which I want to push on to the parent view's (the PM::Screen) navigation controller.

My question is how do I get the collectionView(view, didSelectItemAtIndexPath: index_path) to call a method on the parent PM screen?

Will I have to use NSNotificationCenter?

Upvotes: 0

Views: 3134

Answers (1)

Chris Edwards
Chris Edwards

Reputation: 3602

I have managed with:

self.view.superview.nextResponder.theMethodToCall

Is there a better way?

UPDATE:

I ended up passing a reference to the parent to the child, and using that reference to call the method on the parent

Upvotes: 0

Related Questions