你可以为每个imageView添加点击手势,在tapGesture的selector方法中,你可以提取被点击的imageView。不要忘记将 imageViews 的 userInteractionEnabled 设置为 YES。
//code for adding tap gesture, where img is your imageView
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
[img addGestureRecognizer:tap];
[img setUserInteractionEnabled:YES];
//in selector method
-(void)handleTap:(UITapGestureRecozgnizer *)recognizer
{
UIImageView *imView = (UIImageView *)recognizer.view;
SecondViewController *vc = [[SecondViewController alloc]init];
[vc setImage : imView.image];
[self.navigationController pushViewController:vc animated:YES];
}