假设我想创建以下手势识别器
UITapGestureRecognizer * c1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector([[MyGestureRecognizer ViewWasClicked1:]]; // error [c1 setNumberOfTapsrequired:1]; [c1 setNumberOfTouchesrequired:1]; [[self view] addGestureRecognizer:c1];
+ (void)ViewWasClicked1:(UITapGestureRecognizer *)sender { NSLog(@"click1 mouse down"); }
在MyGestureRecognizer类中.我可以找到什么?
解决方法
语法是:
UITapGestureRecognizer * c1 = [[UITapGestureRecognizer alloc] initWithTarget:[MyGestureRecognizer class] action:@selector(ViewWasClicked1:)]; // error