我正在排列一系列的imageview
,并给它们分配一个TapView
识别器
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(action:)];
[tapRecognizer setNumberOfTouchesRequired:1];
[tapRecognizer setDelegate:self];
imageView.userInteractionEnabled = YES;
[imageView addGestureRecognizer:tapRecognizer];
我已经定义了选择器为:
-(void) action:(id)sender
{
NSLog(@"TESTING TAP");
NSLog (@"%d",[sender tag]);
}
我的程序崩溃了,出现了以下错误信息:
[UITapGestureRecognizer tag]: unrecognized selector sent to instance 0x145d0210