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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:14:52+00:00 2026-05-15T17:14:52+00:00

I have a tableview, and whenever I swipe a row in section A and

  • 0

I have a tableview, and whenever I swipe a row in section A and after that select a row in section B, it thinks I selected the swiped row in section A! I placed a breakpoint to verify and am 100% sure that it thinks it’s that cell AND that it calls it when I select the row in section B.

By swipe I mean that you place your finger one some part of a cell, then drag it across (left or right, doesn’t matter) and then release it. This doesn’t call didSelectRowAtIndexPath, since it is not a tap.

Example:
Swipe on indexpath A.1
Tap on indexpath B.4
OS calls tableView:didSelectRowAtIndexPath: A.1

Am I doing something wrong? What could go wrong?

Full code that handles touches in the specific cells:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    RDLogString(@"(%p) Received touches began", self);
    moveCount = 0;
    UITouch * touch = [touches anyObject];
    touchBegin = [touch locationInView: nil];
    [[self nextResponder] touchesBegan: touches withEvent: event];
}

- (void) touchesMoved: (NSSet * const)touches withEvent:(UIEvent * const)event {
    RDLogString(@"(%p) Received touches moved", self);
    moveCount++;
    [[self nextResponder] touchesMoved: touches withEvent: event];
}

- (void) touchesEnded: (NSSet * const)touches withEvent:(UIEvent * const)event {
    RDLogString(@"(%p) Received touches ended", self);
    if(![self checkUserSwipedWithTouches: touches]){
        [[self nextResponder] touchesEnded: touches withEvent: event];
    }
}

- (BOOL) checkUserSwipedWithTouches: (NSSet * const) touches {
    CGPoint touchEnd = [[touches anyObject] locationInView: nil];
    NSInteger distance = touchBegin.x - touchEnd.x;

    // This code shows an animation if the user swiped
    if(distance > SWIPED_HORIZONTAL_THRESHOLD){
        [self userSwipedRightToLeft: YES];
        return YES;
    } else if (distance < (-SWIPED_HORIZONTAL_THRESHOLD)) {
        [self userSwipedRightToLeft: NO];
        return YES;
    }

    return NO;
}
  • 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-15T17:14:53+00:00Added an answer on May 15, 2026 at 5:14 pm

    I fixed it by, when a swipe was detected and handled, instead of not sending anything, I now send a touchesCancelled, which makes a lot of sense in retrospect I must admit, but it wasn’t really clear that I should do that. I couldn’t find proper documentation on what to do if you didn’t want the action to be handled.

    Code that works:

    - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        moveCount = 0;
        UITouch * touch = [touches anyObject];
        touchBegin = [touch locationInView: nil];
        [[self nextResponder] touchesBegan: touches withEvent: event];
    }
    
    - (void) touchesMoved: (NSSet * const)touches withEvent:(UIEvent * const)event {
        moveCount++;
        [[self nextResponder] touchesMoved: touches withEvent: event];
    }
    
    - (void) touchesEnded: (NSSet * const)touches withEvent:(UIEvent * const)event {
        // If we DO NOT handle the touch, send touchesEnded
        if(![self checkUserSwipedWithTouches: touches]){
            [[self nextResponder] touchesEnded: touches withEvent: event];
        } else { // If we DO handle the touch, send a touches cancelled. 
            self.selected = NO;
            self.highlighted = NO;
            [[self nextResponder] touchesCancelled: touches withEvent: event];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tableView that needs to be updated after information has been inserted
i have a tableview controller, when i select a row its pushing another view
I have a tableView that present a list of Books, each of the table
I have a TableView with 10 sections that are loaded from a plist file
i have a tableView with 3 cells. i want to change .detailTextLabel of that
I have a tableview with data, that i post to the app engine database.
I have a table view which presents a UIViewController whenever a row is tapped
I have an sqlite3 database that is loaded inside a tableview. I have also
i have tableview with custom cell.the table is divided in many section and rows.i
I have a tableView that I am rotating 90 degrees to the left with

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.