2012-06-18 68 views
0

荫开发IAM使用一个uiimageview.And拍摄图像,图一个application.In并添加到第一imageview.And加入uitapgesturerecognizer行动第二imageview.If第二imageview的可以只出现了第一的ImageView的,如果我们点击这个在imageview之外,那么它不检测手势动作。所以请告诉我如何解决这个问题。我的代码就像下面这样。如何使用手势操作将一个ImageView添加到另一个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是两个数组。

回答

0

你尝试与调用[超级则hitTest:点withEvent:方法事件]在点?

+0

No.请简要说明。 – user1400581

+0

请看看这篇文章http://stackoverflow.com/questions/1694529/allowing-interaction-with-a-uiview-under-another-uiview和http://bynomial.com/blog/?p=74希望能帮助到你 。 – Suhaiyl

相关问题