Detect anytouch inside subView (other than a button) touchesEnded
I have a subview, which also contains a UIButton. Now, once I enter the touchesEnded, I want to exec开发者_JAVA技巧ute some instructions only if the main subview was touched (and not the UIButton).
Is there a way to do this??
Thanks in advance. ezbz
Use write your logic using these events ,by comparing the coordinates accordingly .
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *aTouch = [touches anyObject];
CGPoint point = [aTouch locationInView:self.view];
NSLog(@"X%f",point.x);
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
}
精彩评论