我已经在UITableViewCell中添加了集合视图。我的UITableViewCell子类是UICollectionViewDelegate。
现在,如果我尝试使用以下代码加载或推送视图控制器:

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

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

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


我收到错误:“找不到storyboard”

如何从UITableViewCell子类推送或加载UIViewController?

最佳答案

您必须将导航控制器实例传递到collectionView单元格,然后在那里使用它进行推送(不好的想法,懒惰的想法)

要么

创建一个协议委托,以通知您的ViewController您的CollectionView选择了某项,并从ViewController进行推送。

10-06 09:20
查看更多