Pregunta

I have a UICollectionViewController and UIViewController, with the UINavigationController as root.

When I click on a UICollectionViewCell, it pushes the UIViewController

The snippet of code I have for that is:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    UICollectionViewCell *cell = (UICollectionViewCell *)sender;
    NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];

    MyViewController *myVC = (MyViewController *)segue.destinationViewController;


}

But it crashes when I click on the cell and says

"Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController"

I thought by making the UINavigationController root solves this. What am i doing incorrectly?

¿Fue útil?

Solución

Just figured it out actually

went into Editor at the top toolbar, then Embed In, then navigation controller voila

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top