문제

I know it seems like it's a fairly easy to do, but i can't seem to figure it out and i've researched a lot of places but really what i want it's no where. i'm creating a puzzle game and the images are moved around using UIGestureRecognizers but let's say if the puzzle piece does not fit into the right location, i want it to move to it's original position or previous position where i got it from. Can someone please shed some light on this on ho to do this? Thanks

도움이 되었습니까?

해결책

The easiest thing to do would be to add a property to your view controller to store the CGPoint of the puzzle piece before you move it. Check for UIGestureRecognizerStateBegan in the state of the recogniser(which i think you must already be doing in order to start moving the puzzle piece) and update the property with the touch location from the view.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top