0

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 つの配列です。

4

1 に答える 1

0

その時点で[superhitTest:point withEvent:event]を呼び出してみましたか?

于 2012-06-18T07:50:56.940 に答える