タグ1のビューとタグ2のビューの2つのビューがあります。各ビューには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...