Reputation: 1369
In my iPad app...
I am doing some stuff of dragging an object....
My problem is for dragging I need two methods...
some stuff1
some stuff2
Sometimes what happens that the user is not moving the object after touching.
So, whateever somestuff1
has been done.
I need to reverse it back..
So,How would I do that...
Means is there any event or notification that I can fire
if the user does the touches began and not touches ended.
Upvotes: 0
Views: 193
Reputation: 386058
You will always receive a touchesEnded:withEvent:
message or a touchesCancelled:withEvent:
message after you have received a touchesBegan:withEvent:
message. You need to override both methods if you want to know when the user has lifted his finger.
If you want to track whether the user moved the touch before lifting his finger, you have to do that yourself. You can set a flag in your touchesMoved:withEvent:
method, or you can save the original position of the touch in touchesBegin:withEvent:
and then compare it with the final position of the touch in touchesEnded:withEvent:
and touchesCancelled:withEvent:
.
Upvotes: 5
Reputation: 8147
You have a - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
function, too, use it to check if the user hasn't made any moves.
Upvotes: 1