2010-10-15 28 views
1

J'ai trois UIView cas:touchesBegan seulement dans UIView spécifique

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

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

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

} 

Mais je veux que le toch action ne vont dans view2. Il ne fonctionne pas si je fais: locationInView: view2

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

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

} 

Qu'est-ce que je me trompe? Comment puis-je vérifier, quelle vue est la vue que je peux voir sur mon iPhone?

Répondre

1

Définissez userInteractionEnabled sur false dans la vue dans laquelle vous ne souhaitez pas que votre contact soit traité.