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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:45:10+00:00 2026-05-30T01:45:10+00:00

I have a UITableView and UINavigationController, and I’d like to distinguish between two clicks:

  • 0

I have a UITableView and UINavigationController, and I’d like to distinguish between two clicks: 1) normal click that selects a row and 2) a click that happens ANYWHERE else on the screen (other than the buttons on the UINavigationController). I wrote this code:

singleTap = [[UITapGestureRecognizer alloc]
                                     initWithTarget:self action:@selector(singleTapHandler:)];
singleTap.numberOfTapsRequired = 1;

The problem with this however is that it overrides the normal clicks that select a row.

  • 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-30T01:45:11+00:00Added an answer on May 30, 2026 at 1:45 am

    I assume you’re putting the tap recognizer on either the UIWindow itself, or the window’s sole subview. You need to give the tap recognizer a delegate, and that delegate needs to implement gestureRecognizer:shouldReceiveTouch:.

    In that method, you want to return NO if the touch is in a button or if the touch is in a table view cell, and YES otherwise. You need to walk up the view hierarchy, starting with the view that the touch landed in, looking for either of those classes.

    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
        for (UIView *view = touch.view; view; view = view.superview) {
            if ([view isKindOfClass:[UIButton class]])
                return NO;
            if ([view isKindOfClass:[UITableViewCell class]])
                return NO;
        }
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have UITableView.when i click on it's 1 st row one another UITableView opens
I have a UITableView in a UINavigationController that contains a rightBarButtonItem which should hide
I have a configuration UITableView that can launch a colour picker via a UINavigationController
I have two TableViewControllers with a segue in-between. When a user clicks on a
I have a project: first view is uitableview, when you select row uinavigationcontroller pushes
I have a UITableView cell that is going to have a variable size depending
I have a UITableView that displays single large images in each cell. The names
I have a uitableview that loads fairly large images in each cell and the
I have a UIViewController that I load every time I click a button: NearMe
Ok so I have a UITableView and a UINavigationController with a UIBarButtonSystemItemAdd and when

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.