Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to deal with two view controllers one that's in the background called mainController one that presented using a <code>UIPopoverViewController</code> called popoverController. Your popoverController could add a <code>UIPanGestureRecognizer</code> to the views, that the user can drag. The action target of the gestureRecognizer could be a method on the popoverController.</p> <p>Once the user starts a dragging operation your action method is called with the gestureRecognizer as an argument, were the state of the gestureRecognizer is <code>UIGestureRecognizerStateBegan</code>. You could than save the current frame of the view somewere to be able to animate it back, when the dropping fails. It might be necessary to move the view to an other superview (the window for example), because I'm not sure if UIPopoverViewController clipsToBounds its view.</p> <p>As the user draggs, your action method is called over and over with the gestureRecognizer in the state <code>UIGestureRecognizerStateChanged</code>. Use the <code>translationInView:</code> method on <code>UIPanGestureRecognizer</code> to determine how much the user dragged and update the dragged views center/frame/transform accordingly.</p> <p>Once the user lifts his finger the action method is called for a last time with the gestureRecoginzers state set to <code>UIGestureRecognizerStateEnded</code>. Now it's time to find out if the drag was successful. For example the popoverController could ask the mainController via delegation if there's a drop target under the views current position, if so the mainController can take action, else the popoverController would animate the dragged view back to were it came from, and add it back as a subview to it's view.</p> <p>I hope this is somehow comprehensible and helpful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload