Drag a UIView from one UIScrollView to another

Posted by theDuncs on Stack Overflow See other posts from Stack Overflow or by theDuncs
Published on 2012-06-09T16:30:47Z Indexed on 2012/06/09 16:40 UTC
Read the original article Hit count: 202

I have two UIScrollViews on my screen and I need to be able to drag a UIView from one scrollview to the other.

At the moment, I have a UILongGestureRecognizer on the UIView that I want to move, such that when the user starts dragging it, I make the view follow the touch:

- (void)dragChild:(UILongPressGestureRecognizer *)longPress {
    [[longPress view] setCenter:[longPress locationInView:[[longPress view] superview]]];
}

But when I get the boundary of the starting UIScrollView, the view disappears because it's locked into that scrollview's bounds.

Is there a way to "pop" it out of the scrollview when I start dragging such that I can carry it over to the other scrollview?

Also, how do I test for the "drop" location? I want to know if it's been dropped over a certain other view.

Or am I going about this all the wrong way?

Thanks guys

© Stack Overflow or respective owner

Related posts about ios

Related posts about uiview