Posted By

tonic on 07/08/10


Tagged

event CocoaTouch


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Evento Touch con posición


 / Published in: Objective C
 

  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  

You need to login to post a comment.