iOS - 给imageView添加点击

采用 UITapGestureRecognizerweb

UIImageView *photoImage = [[UIImageView alloc] init];
photoImage.userInteractionEnabled = YES;

UITapGestureRecognizer *photoImageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(photoImageClicked)];

photoImageTap.numberOfTapsRequired = 1;
photoImageTap.numberOfTouchesRequired = 1;
[photoImage addGestureRecognizer:photoImageTap];
-(void) photoImageClicked{
 //点击响应
}