markus
markus

Reputation: 1011

UIView + Swipe Gestures info

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.

Upvotes: 0

Views: 573

Answers (2)

omz
omz

Reputation: 53551

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.

Upvotes: 0

seejaneworkit
seejaneworkit

Reputation: 236

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

Upvotes: 1

Related Questions