2010-10-15 24 views
1

我有三個UIView實例:的touchesBegan在特定的UIView

UIView *view1; 
UIView *view2; 
UIView *view3; 

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 

UITouch *touch =[touches anyObject]; 
CGPoint startPoint =[touch locationInView:self.view]; 

} 

但我想的是,TOCH行動只在視圖2去。它不工作,如果我做:locationInView:view2

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 

UITouch *touch =[touches anyObject]; 
CGPoint startPoint =[touch locationInView:view2]; 

} 

我該怎麼做?我如何檢查,哪個視圖是我實際上可以在我的iphone上看到的視圖?

回答

1

在視圖中將userInteractionEnabled設置爲false,您不希望觸摸被處理。

相關問題