Iam は 1 つのアプリケーションを開発しています。その中で 1 つの uiimageview を使用しています。別の画像ビューを取得し、最初の imageview に追加しました。そして、uitapgesturerecognizer アクションを 2 番目の imageview に追加しました。ジェスチャ アクションを検出しないので、これを解決する方法を教えてください。私のコードは次のようになります。
UIImageView *img1=[[UIImageView alloc]initWithFrame:CGRectMake(100,100,500 ,500)];
[self.view addsubview:img1];
float x=[[xvalues objectAtIndex:h] floatValue];
float y=[[yvalues objectAtIndex:h] floatValue];
UIImage *pinimage=[UIImage imageNamed:@"PINpurple.png"];
UIImageView *img3=[[UIImageView alloc]initWithFrame:CGRectMake(x-pinimage.size.width,y-pinimage.size.height,pinimage.size.width ,pinimage.size.height)];
img1.userInteractionEnabled=YES;
img3.userInteractionEnabled=YES;
UITapGestureRecognizer *tap5=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(calculate:)];
tap5.delegate=self;
[img3 addGestureRecognizer:tap5];
[img1 addSubview:img3];
ここで、xvalues と yvalues は 2 つの配列です。