我有一个imageview
我添加了一个tapRecognizer
这样的:
recognizer1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap1)];
UIImageView *crossImage = [[UIImageView alloc] initWithFrame:CGRectMake((jrect.origin.x+jrect.size.width), (jrect.origin.y-20), 30, 30)];
crossImage.image = [UIImage imageNamed:@"cross.png"];
[crossImage addGestureRecognizer:recognizer1];
[self addSubview:crossImage];
handleTap
方法:
- (void)handlePan1:(UITapGestureRecognizer *)recognizer
{
NSLog(@"FV");
}
当我单击图像时,没有任何反应。怎么了?