我已将我的collectionViewCell中的push segue连接到storyboard中的viewController,但是当单击一个单元格时没有任何反应。我该怎么做才能做到这一点?
-(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];
}
答案 0 :(得分:0)
在UICollectionViewDelegate协议中查看collectionView:didSelectItemAtIndexPath:
另外,在发布前快速谷歌! 3秒的搜索引导我