Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What works best for me is to not move the uiImageView that is in the scrollview but rather create a duplicate view (in the controlling view controller) and move that with the touches, then add that to the main view and then subsequently remove the original. </p> <p>This approach also looks better if the user changes their mind halfway through and decides to not drag it out after all.</p> <p>EDIT: I checked my app to refresh myself what I do and I too don't get touchesMoved or ended on the original item. I do have a gesture recognizer on each of the views in the slideview and when this is fired it tells the delegate (the viewcontroller that is the parent of the scrollview) that the drag is in process. From the object passed I can get the CGPoint and act accordingly:</p> <pre><code>UILongPressGestureRecognizer *myRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(drag:)]; [myRecognizer setDelegate:self]; [myItemInsideScrollView addGestureRecognizer:myRecognizer]; -(void)drag:(UILongPressGestureRecognizer *)sender { [self.view bringSubviewToFront:[(UILongPressGestureRecognizer*)sender view]]; CGPoint translatedPoint = [sender locationInView:self.view]; // if we are not already dragging we create the duplicate view // if we are already dragging just update the location of the duplicate view // next check if drag has ended and if so call a method to do what we want if ( dragging ) { if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) { [self checkForDragRelease:(CGPoint)translatedPoint]; } } } </code></pre>
    singulars
    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. This table or related slice is empty.
    1. 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