views:

157

answers:

1

Hi all!

I've search for some clues on this problem without much success. Hope someone can kick me in the right direction.

I am prototyping a couple of apps where I need to design my own GUI. The GUI is made up by two separated UIViews where one of them contains a small thumb of an image. I want to be able to drag this thumb from the first view to the other. Simple as that! But I haven't figured out how this is done. Here is the exact flow I am looking for:

  • touch the thumb
  • animate a small enlargement of the thumb
  • drag the thumb to the other UIView
  • drop the thumb
  • animate a shrink of the thumb

Not particularly strange, but the thumb remains related to the first view all the time. I've tried to move the thumb via the first views superview and then back to the second view, but with no luck.

+1  A: 

If the question is "How to move a UIView from one superview to another?", the answer is: [myNewSuperview addSubview:myThumbView].

Nikolai Ruhe
Does this call automatically remove the myThumbView from the first view?
jollyCocoa
Exactly. Read the docs: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/addSubview:
Nikolai Ruhe