Ios 按collectionView上的segue单击

Ios 按collectionView上的segue单击,ios,objective-c,iphone,uicollectionview,Ios,Objective C,Iphone,Uicollectionview,我已将collectionViewCell中的推送序列连接到故事板中的viewController,但当单击单元格时,什么也不会发生。为了实现这一点,我应该做些什么 准备工作 viewDidLoad 签出UICollectionViewDelegate协议中的collectionView:didSelectItemAtIndexPath: 另外,在发帖前快速谷歌一下!3秒钟的搜索让我找到了 你不应该做任何事情。如果segue是由cell生成的,则不需要任何代码来执行segue。只需确保您的调用

我已将collectionViewCell中的推送序列连接到故事板中的viewController,但当单击单元格时,什么也不会发生。为了实现这一点,我应该做些什么

准备工作 viewDidLoad
签出UICollectionViewDelegate协议中的collectionView:didSelectItemAtIndexPath:

另外,在发帖前快速谷歌一下!3秒钟的搜索让我找到了


你不应该做任何事情。如果segue是由cell生成的,则不需要任何代码来执行segue。只需确保您的调用是可点击的——例如,如果它有一个图像视图,请确保将其userInteractionEnabled设置为YES(图像视图默认为NO)。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{


    if ([segue.identifier isEqual:@"toHomeProfile"])
    {
        HomeProfileViewController * dvc = segue.destinationViewController;
        self.selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];

    
        dvc.imageArray = [[NSMutableArray alloc]init];
        dvc.imageArray = [imageDic objectAtIndex:self.selectedIndexPath.item];


    }
}
- (void)viewDidLoad
{
   [super viewDidLoad];

    CHTCollectionViewWaterfallLayout *layout = [[CHTCollectionViewWaterfallLayout alloc] init];

    layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
    layout.headerHeight = 0;
    layout.footerHeight = 0;
    layout.minimumColumnSpacing = 5;
    layout.minimumInteritemSpacing = 5;
    self.collectionView.collectionViewLayout = layout;


    _collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    _collectionView.dataSource = self;
    _collectionView.delegate = self;
    _collectionView.backgroundColor = [UIColor whiteColor];
    [_collectionView registerClass:[CHTCollectionViewWaterfallCell class]
    forCellWithReuseIdentifier:CELL_IDENTIFIER];

}