Objective c collectionView didSelectItemAtIndexPath不';t工作

Objective c collectionView didSelectItemAtIndexPath不';t工作,objective-c,delegates,uicollectionview,Objective C,Delegates,Uicollectionview,这是我的代码,不起作用 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { InfoViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"infoID"]; [self.navigationControlle

这是我的代码,不起作用

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    InfoViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"infoID"];

    [self.navigationController pushViewController:vc animated:YES];
}
是否也需要使用这种方法

- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}

无论如何,这没有帮助

您是否将该类设置为集合视图委托?是的,我设置了委托ID您是否设置了断点来测试它是否被调用?您是如何设置代理的?我已修复。导航控制器出现问题