I created a dynamic view of UIimage and and UITapGestureRecognizer to see how it looks
UIImageView *image = [[UIImageView alloc ] initWithFrame:CGRectMake(x, 0, 200, 150)]; NSString *ImageURL = [str objectForKey:@"imageLink"]; NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]]; image.image = [UIImage imageWithData:imageData]; UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)]; singleTap.numberOfTapsRequired = 1; image.userInteractionEnabled = YES; [image addGestureRecognizer:singleTap]; [documentory addSubview:image];
and my method of action like this
-(void)tapDetected:(UIGestureRecognizer *)recognizer{ NSLog(@"single Tap on imageview"); }
I want to pass tapDetected string parameters, can someone tell me how to do this, thank you very much
source share