How to make a character following your finger in Cocoa?
It was kind simple in other OS. I just got mouse movement x and y and redraw my character, however I do not see mouse event in Cocoa. COuld somebody point on a开发者_StackOverflow社区 code samples?
What you want is a UIPanGestureRecognizer (see the WWDC10 videos gesture recognizer videos). With the Pan gesture recognizer, when the user press and holds their finger, then begins to drag it, you can get direction of the drag, redraw as they drag.
Get the coordinates in the frame where they were touched, use that as a the point by which you animate your view, so the view always moves where the user started dragging from.
精彩评论