0

Im using the following code:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];   
    self.location = [touch locationInView:self.view];    
    NSLog(@"%@", NSStringFromCGPoint(location));
}

In order to try and find where the user might touch the screen, and i thought that [touches anyobject] would allow it to detect where the user has touched the screen even if another object has been selected. However when I select a button it seems that it is not the case. Could anyone help me out?

Thanks!

James Dunay
  • 2,714
  • 8
  • 41
  • 66

1 Answers1

1

UIButtons by default "absorb" the touch, so you have to manually pass it along.

Check out this thread for more info: Is there a way to pass touches through on the iPhone?

Community
  • 1
  • 1
Greg
  • 1,296
  • 2
  • 11
  • 26