Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Getsy,</p> <p>Try the code for drag and drop the objects :</p> <pre><code>-(void)dragAndDropWithGesture { UILongPressGestureRecognizer *downwardGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(dragGestureChanged:)]; [scrollViewAlfabeto addGestureRecognizer:downwardGesture]; for (UIGestureRecognizer *gestureRecognizer in myscrollView.gestureRecognizers) { [gestureRecognizer requireGestureRecognizerToFail:downwardGesture]; } } - (void) dragGestureChanged:(UIPanGestureRecognizer*)gesture { CGPoint point = [gesture locationInView:scrollViewAlfabeto]; if (gesture.state == UIGestureRecognizerStateBegan) { [imageViewToMove removeFromSuperview]; [self.view addSubview:imageViewToMove]; UIView *draggedView = [myscrollView hitTest:point withEvent:nil]; if ([draggedView isKindOfClass:[UIImageView class]]) { imageViewToMove = (UIImageView*)draggedView; } } else if (gesture.state == UIGestureRecognizerStateChanged) { imageToMove.center = point; } else if (gesture.state == UIGestureRecognizerStateEnded || gesture.state == UIGestureRecognizerStateCancelled || gesture.state == UIGestureRecognizerStateFailed) { // Determine if dragged view is in an OK drop zone // If so, then do the drop action, if not, return it to original location NSLog(@"point.x final:%f", point.x); NSLog(@"point.y final:%f", point.y); if (CGRectContainsPoint(goal.frame, point)){ imageToMove.frame = CGRectMake(167, 159, 100, 100); } else{ [imageToMove removeFromSuperview]; [myscrollView addSubview:imageToMove]; [imageToMove setFrame:CGRectMake(12, 38, 100, 100)]; imageToMove = nil; } } } </code></pre> <p>May this code will help you out.</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. 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