代码如下:
UIImageView *imageView = [self getYourImageView];
imageView.image = [self getYourImage];
imageView.userInteractionEnabled = YES;
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
[imageView addGestureRecognizer:singleTap];
[singleTap release];
UIImageView *imageView = [self getYourImageView];
imageView.image = [self getYourImage];
imageView.userInteractionEnabled = YES;
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(yourHandlingCode:)];
[imageView addGestureRecognizer:singleTap];
[singleTap release];