Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6992457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:38:12+00:00 2026-05-27T19:38:12+00:00

I am developing an application that allows the user at a certain point to

  • 0

I am developing an application that allows the user at a certain point to drag and drop 10 images around. So there are 10 images, and if he/she drags one image onto another, these two are swapped.

A screenshot of how this looks like:

Screenshot of application

So when the user drags one photo I want it to reduce its opacity and give the user a draggable image on his finger which disappears again if he drops it outside of any image.

The way I have developed this is the following. I have set a UIPanGesture for these UIImageViews as:

for (UIImageView *imgView in editPhotosView.subviews) {
        UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(photoDragged:)];
        [imgView addGestureRecognizer:panGesture];

        imgView.userInteractionEnabled = YES;

        [panGesture release];
}

Then my photoDragged: method:

- (void)photoDragged:(UIPanGestureRecognizer *)gesture {

    UIView *view = gesture.view;
    if ([view isKindOfClass:[UIImageView class]]) {
        UIImageView *imgView = (UIImageView *)view;
        if (gesture.state == UIGestureRecognizerStateBegan) {
            imgView.alpha = 0.5;

            UIImageView *newView = [[UIImageView alloc] initWithFrame:imgView.frame];
            newView.image = imgView.image;            
            newView.tag = imgView.tag;
            newView.backgroundColor = imgView.backgroundColor;
            newView.gestureRecognizers = imgView.gestureRecognizers;

            [editPhotosView addSubview:newView];            
            [newView release];
        }
        else if (gesture.state == UIGestureRecognizerStateChanged) {
            CGPoint translation = [gesture translationInView:view.superview];
            [view setCenter:CGPointMake(view.center.x + translation.x, view.center.y + translation.y)];
            [gesture setTranslation:CGPointZero inView:view.superview];
        }
        else { ... }
    }
}

Thus as you see I add a new UIImageView with 0.5 opacity on the same spot as the original image when the user starts dragging it. So the user is dragging the original image around. But what I want to do is to copy the original image when the user drags it and create a “draggable” image and pass that to the user to drag around.

But to do that I have to pass the user touch on to the newly created “draggable” UIImageView. While it’s actually set to the original image (the one the user touches when he starts dragging).

So my question is: How do I pass the user’s touch to another element?.

I hope that makes sense. Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:38:13+00:00Added an answer on May 27, 2026 at 7:38 pm

    In the end I decided to indeed drag the original image and leave a copy at the original place.

    I solved the issue with the gesture recognizers I was having by re-creating them and assigning them to the “copy”, just like PragmaOnce suggested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application that allows for a user to manage some individual
I'm currently developing a web application that has one feature while allows input from
I'm developing an application that allows the user to pick an image from the
I am developing a web application that allows a user to add entries to
I'm developing this application on an iPad. It has a function that allows user
I'm developing a Ruby on Rails application that needs to allow the user to
I'm developing an application with a feature that allows users to mark places on
I'm developing and application that runs as a Windows service. There are other components
I'm developing an application that manages network interfaces on behalf of the user and
I am actually developing and application that has around 15 modules, all of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.