0

I have added collection view in a UITableViewCell. My UITableViewCell subclass is the UICollectionViewDelegate. Now if I try to load or push a view controller using the below code:

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{

    ExhibitDetailsViewController* detailViewController = [self.storyboard  instantiateViewControllerWithIdentifier:@"exhibitDetail"];
    detailViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    [self.navigationController pushViewController:detailViewController animated:YES];
}

I get the error: "storyboard not found"

How can I push or load a UIViewController from a UITableViewCell subclass?

siburb
  • 4,880
  • 1
  • 25
  • 34
iosDev
  • 604
  • 3
  • 12
  • 28

1 Answers1

1

You have to either pass your navigation controller instance through to the collectionView cell and use it there to push(bad, lazy idea)

OR

Create a protocol delegate to inform your ViewController that your CollectionView selected something and push from the ViewController.

Sean Lintern
  • 3,103
  • 22
  • 28