1

Im making an iPad app that will have some objects on the screen in a menu area. I want the user to be able to touch down and drag from one of these objects to place a new copy of that object on the view.

To further explain, say I have a checkers chip on the side of the UIView in the "game piece" / menu area. I want the user to touch down and drag from that checkers piece to drag a new checker piece onto the game board. I dont want the original checker to move, its just a place holder, but I want to create a new object that is dragged from the first checker.

I see a couple of ways to do that however I cant figure out how to do it without the user picking up their finger to reselect the new game piece. I want the new piece to be drag able immediately after touching the first place holder object.

Any ideas? Please and thank you for the assistance.

RachelD
  • 4,072
  • 9
  • 40
  • 68
  • You coul'd always have two copies of view on of top on eachother. When the top one is dragged away (you know that on touchesMoved:) you simply create a third one (which is created on original position under or on top of the one that stayed on it's original place) – Rok Jarc Mar 14 '12 at 19:42
  • And if you're looking for dragging code it's here: http://stackoverflow.com/questions/4982277/uiview-drag-image-and-text/8332581#8332581 – Rok Jarc Mar 14 '12 at 19:53

1 Answers1

0

I've solved this before by creating a copy of the UIView that I wish to move, then using the UIResponder API (touchesBegan, etc.) to move the new copy in its superview based on the drag gesture translation, thereby leaving the original "menu" view in situ. Does this make sense?

When you create the moveable copy, you can set its alpha or create a border or some other visual confection to indicate the provisional nature of the drag object.

FluffulousChimp
  • 9,157
  • 3
  • 35
  • 42