1

So, I have a custom UIView inside a UIScrollView. I am able to detect the touches Events in the customUIView. I am trying to drag the UIView outside the UIScrollView onto a Canvas (UIView). However, when it gets out of bounds from the SrollView, it just hides behind it? How can I overcome this? Thanks guys!

hop
  • 2,518
  • 11
  • 40
  • 56
nagendrarp
  • 13
  • 1
  • 4

2 Answers2

8

When you start dragging the view, remove it from the superview that is the UIScrollView, and make it a subview of the app's Window, and bring it to front (z-order-wise).

But first you need to calculate (convert) the dragging view's frame with regards to the window, since the coordinates will be different after changing its superview.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
macbirdie
  • 16,086
  • 6
  • 47
  • 54
0

you can use this method [UIView removeFromSuperView];

Shmidt
  • 16,436
  • 18
  • 88
  • 136