Evento Touch con posición


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
  2. UITouch *touch = [[event allTouches] anyObject];
  3. CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow];
  4. NSLog(@"Position of touch: %.3f, %.3f", pos.x, pos.y);
  5.  
  6. }
  7.  
  8. - (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
  9. UITouch *touch = [[event allTouches] anyObject];
  10. CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow];
  11. NSLog(@"Position of touch: %.3f, %.3f", pos.x, pos.y);
  12.  
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.