Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

theprizerevealed

macrumors regular
Original poster
Feb 26, 2016
183
12
I wish to drag and drop an image to a specific location the screen. I have a tutorial that seems to explain how to do the dragging:

But it isn't clear to me how to drop the image into another location and cause it to lock into place and confirm that it is dropped in the proper location. Is that done manually in the code by specifying the numbers of the screen location? That seems very cumbersome.

I investigated the tableview drage and drop features but that doesn't seem suited to my needs. Any suggestions? thanks
 
I wish to drag and drop an image to a specific location the screen. I have a tutorial that seems to explain how to do the dragging:

But it isn't clear to me how to drop the image into another location and cause it to lock into place and confirm that it is dropped in the proper location. Is that done manually in the code by specifying the numbers of the screen location? That seems very cumbersome.

I investigated the tableview drage and drop features but that doesn't seem suited to my needs. Any suggestions? thanks
Drag and drop isn't a fundamental concept of iOS, there isn't a super simple way to do it.

I'd suggest using a UIPanGestureRecognizer. Use Core Animation to animate the dragging of the image to wherever the user's finger is.

This isn't super simple, you need a pretty good grasp on a lot of concepts (auto layout, how frames work, animation, gesture recognizer, image views). It's not for new programmers, that's for sure. It took me like five months to really get those basics down, and took probably a full year to do it well. Then again, iOS/ObjC was my first programming language, so if you have prior experience you may find it easier.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.