2010-10-15 52 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,您不希望触摸被处理。