I dont know How to get following type of functionality in my app.
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 ?
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
That all depends on the kind of implementation you want to do. It can be UIImageView,UIbutton etc. The advantage with UIIMageView could be you can easily implement UIGestureRecognizer to move the views..
For an app I built I used the touches functions:
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
for dragging UIImageViews around. Then you can use the CGRectContainsRect or CGRectContainsPoint to detect if the puzzle piece is in the right location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With