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

  • Home
  • SEARCH
  • 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 799251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:05:49+00:00 2026-05-14T23:05:49+00:00

I’m working on a navigation-based iPhone-only app that serves two main purposes: One, to

  • 0

I’m working on a navigation-based iPhone-only app that serves two main purposes: One, to present data in a hierarchical view, allowing users to drill down and eventually edit said data, and, two, to all users to perform a default action when the table view cell is tapped. I now need to offer a small set of options tied to the same data; however, both the didSelectRowAtIndexPath: and accessoryButtonTappedForRowAtIndexPath: methods are obviously taken.

So, my options seem to be to implement a double-tap method, wherein the small list of additional options would be presented after (you guessed it) a double-tap on said table row; or, preferably, a tap-and-hold method. From what I can tell, tap-and-hold seems like the way to go in SDK 4.0 – which does me no good right this red-hot minute. I decided to go with the double-tap option, but I’m having a little trouble.

First and foremost, the touchesBegan:withEvent: method does not seem to be getting called at all; a breakpoint placed within the method is never called while the application runs, and the table view responds exactly as it did before I inserted the method (which is to say, it performs the default action):

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *aTouch = [touches anyObject];
    if (aTouch.tapCount == 2) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
}

Second, I don’t really need to handle a single-tap – the didSelectRowAtIndexPath: method can handle the single-tap just fine. The double-tap is the funky one I want to handle. I suspect the answer is going to contain the phrase, “You can’t have the table view handle the single-tap and the touchesBegan: method handle the double-tap. The touch handling methods have to handle all of them.”

I would really appreciate some guidance from some of you who’ve dealt with this issue. Thanks in advance.

  • 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-14T23:05:50+00:00Added an answer on May 14, 2026 at 11:05 pm

    Okay, after a week of head-scratching and mumbling under my breath, I’ve finally come to the following conclusion: While what I want to do might theoretically be possible using the current version of iPhone OS, the effort to make it work is going to be Herculean in scale. Seeing as how iPhone OS 4 is due out in the near future, I have elected to use a 4.0 SDK feature to implement the behavior I’m looking for.

    Specifically, what I have done is this:

    // in my tableView:cellForRowAtIndexPath: method
    static NSString *CellIdentifier = @"CustomCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:self options:nil];
        cell = tvCell;
        self.tvCell = nil;
    }
    UILabel *label;
    label = (UILabel*)[cell viewWithTag:1];
    label.text = [NSString stringWithFormat:@"Main Label"];
    label = (UILabel*)[cell viewWithTag:2];
    label.text = [NSString stringWithFormat:@"Sub Label"];
    UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
    [[cell viewWithTag:0] addGestureRecognizer:recognizer];
    [recognizer release];
    UIImage *theImage = [UIImage imageNamed:@"silhouette.png"];
    UIImageView *pictureView = (UIImageView*)[cell viewWithTag:0];
    pictureView.image = theImage;
    return cell;
    

    I created a separate NIB file for the custom cell; it’s just a tableViewCell object with an imageView (for a contact’s photo) on the far left, and two labels in the center (a main label with larger text and a sub-label with smaller text). The cellForRowAtIndexPath: method loads this custom cell as necessary, and then populates the cell with some static data (this will obviously be changed when I incorporate this code into my existing app). I only had to implement one new method for the gesture recognizer:

    - (void)handleLongPress:(UILongPressGestureRecognizer*)sender {
    NSLog(@"Long press detected.");
    }
    

    Obviously, this, too, will be fleshed out when I actually put it to use.

    The whole deal works like a charm. Tapping and holding on the cell fires the “Long press detected” log, and a regular single-tap fires a similar “Short press detected” log in the tableView:didSelectRowAtIndexPath: method.

    Hope this helps somebody.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.