2011-01-10 54 views
0

我有一個UIView和幾個圖像視圖作爲UIView上的子視圖。我需要實現這種情況,「當在視圖上觸摸圖像視圖時,其他圖像視圖觸摸事件將不會傳送」。獨家Touch在UIView上無法在UIView和多個圖像視圖上工作

我使用UIView的獨家觸摸屬性,但是當我觸摸其中一個子視圖時,我同時觸摸了其他子視圖的觸摸事件也提供觸摸事件。 我還爲所有視圖設置了多點觸控禁用。

回答

0
for (UITouch *touch in touches) 
{ 
    currentTouch=touch; 

    if (CGRectContainsPoint([self.view frame], [touch locationInView:self.image1view])) 
    { 
     Give desired action here…. 
     [self transformSpinnerwithTouches:touch]; 
    } 
    else 
     if (GRectContainsPoint([self.view frame], [touch locationInView:self.imageview2])) 
     { 
      Give desired action here as well…. 
      [self dispatchTouchEvent:[touch view]WithTouch:touch]; 
     } 
}