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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:22:00+00:00 2026-05-19T10:22:00+00:00

Today on my creative time I did some quite comprehensive research on how to

  • 0

Today on my creative time I did some quite comprehensive research on how to steal touches from a UIScrollView and send them instantly to a specific subview, while maintaining the default behavior for the rest of the scroll view. Consider having a UIPickerView inside of a UITableView. The default behavior is that if you drag your finger over the picker view, the scroll view will scroll and the picker view will remain unchanged.

The first thing I tried was to override

- (BOOL)touchesShouldCancelInContentView:(UIView *)view

and simply not allow the UIScrollView to cancel touches inside the picker view. This works, but it has an unpleasant side effect. You would like the picker view to respond immediately and thus you will have to set delaysContentTouches to NO. The problem is that you don’t want the rest of the table view to respond immediately, because if it does the table view cell will always get highlighted for a few milliseconds before the scrolling starts.

The second thing I tried was to override

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

because I had read that the scroll view always returns itself, so that it will “steal” the touches from its subviews and later send them to the subview if they weren’t of interest to the scroll view. However, this isn’t true anymore. UIScrollView’s default implementation of hitTest:withEvent: actually returns the subview that should receive the touch. Instead it uses gesture recognizers to intercept the touches.

So the third thing I attempted was to implement my own gesture recognizer and cause it to fail if the touch was outside of the picker view and otherwise succeed. Then I set all the scroll view’s gesture recognizers to fail unless my gesture recognizer failed using the following code:

for (UIGestureRecognizer * gestureRecognizer in self.tableView.gestureRecognizers)
{
    [gestureRecognizer requireGestureRecognizerToFail:myRecognizer];
}

This does in fact steal the touches from the scroll view, but the picker view never receives them. So I though maybe I could just send all the touches that my gesture recognizer receives using this code:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch *touch in touches)
        [touch.view touchesBegan:touches withEvent:event];
}

The above code is a simplified version. I also make sure that the view is a picker view (or one of it’s subviews) and set the appropriate state for the gesture recognizer as I mentioned above. I also did the same for canceled, ended and moved. However, the picker view was still not responding.

I also tried one last thing before returning to my regular work. During my extensive googling I read that nested UIScrollViews just magically worked since 3.x, so I tried putting my picker view inside a nested UIScrollView and set the following properties on it:

scrollView.delaysContentTouches = NO;
scrollView.canCancelContentTouches = NO;

As one would expect the outer scroll view didn’t treat the inner scroll view any different than it treated the picker view, so the inner scroll view did not receive the touches. I thought that it was a long shot, but it was simple enough to implement, so I thought it was worth to give it a shot.

What I know is that UIScrollView has a gesture recognizer named UIScrollViewDelayedTouchesBeganGestureRecognizer that intercepts the touches and sends them to the appropriate subview after 150 (?) ms. I’m thinking that I should be able to write a similar recognizer that causes the scroll view’s default recognizers to fail and instead of delaying the touches immediately sends them to the picker view. So if anyone knows how to write such a recognizer please let me know and if you have any other solution to the problem, you’re very welcome share that as well.

Thank you for reading through the whole question and even if you don’t know the answer you could still upvote the question so that it gets more attention (hopefully from someone that can answer it). Thanks! 🙂

  • 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-19T10:22:00+00:00Added an answer on May 19, 2026 at 10:22 am

    Sometimes you have to ask the question before you can find the answer. Dan Ray had a similar problem and solved it with a very different solution.

    - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    {
        UIView* result = [super hitTest:point withEvent:event];
    
        if ([result.superview isKindOfClass:[UIPickerView class]])
        {
            self.scrollEnabled = NO;
        }
        else 
        {
            self.scrollEnabled = YES;    
        }
        return result;
    }
    

    I’ve tested the code and it works fine for me as well. However, this is not really stealing touches from the scroll view, so if anyone knows how to actually steal touches that would be great.

    Source:
    UIPickerView inside UITableView.tableFooterView doesn't receive drag touches

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

Sidebar

Related Questions

Today I am trying to remove some bytes from an EXE file. Inside the
Today I was reading code from some very popular numerical libraries written in FORTRAN
Today i have a little problem containing a File Upload. First some Infos: Rubyversion:
Today we have received some strange exceptions on our production website. They all have
Today I had an interview on which I asked candidate quite usual and basic
Today I made some tests and I am curious of the results. I made
Today I migrated an old application from EF 4.2 to EF 4.3.1. In my
Today I wanted to write a simple php script, but I got some annoying
Today i did learn two ways of accessing the array, i would like to
Today, no matter what I did, my application just would not recognise a change

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.