我有 2 个视图:带有标签 1 的视图和带有标签 2 的视图。每个视图都有两个手势识别器。
CGRect tempRect=CGRectMake(0, 0, 100, 100);
for (int i=1; i<=2; i++) {
UIView *tempView=[[UIView alloc] initWithFrame:tempRect];
UIImageView *tempImageView=[[UIImageView alloc]initWithFrame:tempRect];
tempImageView.image=[UIImage imageNamed:[NSString stringWithFormat:@"%@%d%@",@"image_",i,@".png"]];
UISwipeGestureRecognizer *tempRecognizer = [[UISwipeGestureRecognizer alloc] init];
[tempRecognizer performSelector:@selector(SwipeRight:) withObject:[NSNumber numberWithInt:i]];
[tempRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[tempView addGestureRecognizer:tempRecognizer];
[tempView addSubview:tempImageView];
tempView.tag=i;
[self.view addSubview:tempView];
}
我有一个方法:管理滑动的 SwipeRight....
-(void)SwipeRight:(NSNumber*)MyTag{
int MyProgr = [MyTag intValue];
}
传递标签的正确方法是什么?使用我的代码时出现错误:
[UISwipeGestureRecognizer SwipeRight:]: unrecognized selector sent to instance...