Search code examples
iphoneobjective-cioscocoa-touchios4

iPhone : How do I drag or move UIImage/UIButton as shown below?


I dont know How to get following type of functionality in my app.

enter image description here

As shown in above figure user can slide(drag) different image parts and user can assemble image.

Can any one tell me which control is this ? Or any tutorial for it ?


Solution

  • Check out the MoveMe sample app. It will show you how to allow movement of subviews by touch and drag.

    You can then create imageViews for each of your puzzle pieces that can be moved around.

    Once you have accomplished this you need to check during movement of a piece to see when it gets close enough to it's correct spot in the puzzle so it can snap into place when then user lets go of the piece.

    http://developer.apple.com/library/ios/#samplecode/MoveMe/Introduction/Intro.html