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 6100157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:21:15+00:00 2026-05-23T13:21:15+00:00

I have a question which is mostly answered by this question . However, I

  • 0

I have a question which is mostly answered by this question.

However, I have a slight variation of the task. I want to drag and drop UIImageViews from a UIPopover controller to another UIView, but the number of image views contained in the popover exceeds the iPad’s height, meaning users must also be able to scroll the popover’s content (which is presented in a UITableView).

I’m using a UIPanGestureRecognizer to detect the attempt to drag and drop, but this essentially disables the scrolling by intercepting the event. I think I know how to handle this. Scrolling is essentially a vertical move, while dragging and dropping is more of a lateral move. So, I’m thinking that when I detect the beginning of a drag and drop, I have to detect if it’s primarily a vertical move. If so, I have to somehow trigger scrolling and pass the motion off to that “handler” instead.

Any a) feedback on whether this is the right approach, and b) any pointers on the implementation?

  • 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-23T13:21:15+00:00Added an answer on May 23, 2026 at 1:21 pm

    I successfully completed this and would like to share the solution.

    Because we’re dealing with a UITableView inside a UIPopoverController, the first issue you have to deal with is the fact that the user may simply want to scroll the tableview, not drag the contents of one of its cells (in this case a UIImageView). I solved this by attaching a custom gesture recognizer to my custom image view class, meaning that every image view loaded into the table view had a custom gesture recognizer attached to it.

    The crux of that gesture recognizer was the following code inside the touchesMoved method:

    if (ABS(currentTouchLocation.y-self.firstTouchLocation.y) > 4 && ABS(currentTouchLocation.x-self.firstTouchLocation.x)< 2)
    {
    
        self.state = UIGestureRecognizerStateFailed;
    
    }
    

    Causing the gesture recognizer to fail allows the touch event to proceed to the table view, as normal. The use of > 4 and < 2 conditions controls the angle at which one considers an action to be a vertical scroll versus a drag and drop.

    The rest of the code goes in the gesture’s action method. Here, one of the first things you do is create a copy of the tableview cell’s image view and add it to the main window:

    self.newImageView =  [[ElementImageView alloc] initWithImage:self.image];
        self.newImageView.frame = [self.superview convertRect:self.frame toView:[UIApplication sharedApplication].keyWindow];
    
        [[UIApplication sharedApplication].keyWindow addSubview:self.newImageView];
    

    It was at this point I struggled the most. I kept trying to find a way to transfer the touch to this new image view, or to somehow trigger a touch programmatically, so my dragging motion could carry on seamlessly. This was totally unnecessary. Dragging is implemented by applying to your view the x/y delta between the first position of its associated touch versus the latest position. Instead, I simply left my original image view where it was and applied the delta to my copy.

    If you follow this approach, you can easily drag a copy of a UIImageView from a UITableView/UIPopOverController anywhere on the screen.

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

Sidebar

Related Questions

With this question I am mostly looking for answers from people that have implemented
this is my first time posting here, I have a question which I have
I have this question in which I have a SQL Server Compact Edition database
This question is more or less programming language agnostic. However as I'm mostly into
I have a question which is described below: What problems would arise for testing
I have a question which I think involves conditional entropy in the field of
I have a question which may be somewhat silly because I'm pretty sure I
I have few Question for which I am not able to get a proper
I have an SQL question which may be basic to some but is confusing
I am learning JPA and have one question: In which situations we need more

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.