0

i've just implemented a swipe gesture in my UIView, and I want it to 'move' according to the gesture. Long story short, I need to get the current "X and Y" coordinates during the swipe, to move the UIView.

Currently I have a "Swipe Gesture" linked to my UIView, an IBAction linked to the Swipe and the working following code:

- (IBAction)mostrar_contas:(UIGestureRecognizer*)sender {
     campo.text=@"OK";
}

BTW: the 'campo' thing is a test UITextField. Thanks.

markus
  • 1,011
  • 2
  • 10
  • 17

2 Answers2

1

Check out UIPanGestureRecognizer - it gives you continuous feedback for current translation and velocity.

seejaneworkit
  • 236
  • 1
  • 6
0
CGPoint location = [sender locationInView:myView];

EDIT: I'm not entirely sure if this works with a UISwipeGestureRecognizer. A UIPanGestureRecognizer, as suggested by seejaneworkit might be the better choice in this case.

Community
  • 1
  • 1
omz
  • 53,243
  • 5
  • 129
  • 141
  • Not quite sure how to use the 'UIPanGestureRecognizer', could you give me an example or a hint? – markus Oct 02 '11 at 16:06
  • [Event Handling Guide for iOS: Gesture Recognizers](http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizers/GestureRecognizers.html) – omz Oct 02 '11 at 16:12