1

I need to drag and drop UIButtons(image) on bigger UIImageView. I want to implement following functionality -

  1. While dragging if the button is inside UIImageView then only it should drop,else it should not drop
  2. When touching down and dragging it should immediately create a new UIButton at original position.
  3. After the UIButton is dropped it should not move from its new position.

Thanking in advance.

memmons
  • 40,222
  • 21
  • 149
  • 183
niks
  • 544
  • 11
  • 28

1 Answers1

0

I'm not quite sure if this is what you're looking for but what you can do is start a timer on the touchDown action that will trigger a method that makes the button update to the current CGPoint touch location. Then add if statements to control whether it's inside an image or not. To make the button stop, use the touchUpInside method and invalidate the timer.

Fernando Cervantes
  • 2,962
  • 2
  • 23
  • 34