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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:14:40+00:00 2026-06-03T06:14:40+00:00

I have a dynamic table view with cells populating from a db. When a

  • 0

I have a dynamic table view with cells populating from a db.
When a cell is selected the user should have the possibility to choose few other options.
I know how to push another view when the cell is selected but I don’t like this approach graphically.
It could be better if, for example, the same cell could flip over and show the options (then flip back) maybe with a swipe.
Or the entire cell could slide off the screen revealing the options, or another view could slide down from the cell and then slide back up.

Which of these solutions is the easiest to do?
Can anyone point me to the right direction? I don’t need the code of course, I’m here to learn and I just need to know what to look at.
Until now, I’ve read something about subclassing the UITableViewCell, but, honestly, I haven’t got it yet.
Any input will be greatly appreciated.

  • 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-06-03T06:14:42+00:00Added an answer on June 3, 2026 at 6:14 am

    You would use a UITableViewCell subclass with a foreground and a background view and a UIPanGestureRecognizer. this recognizer will trigger the swipe and handles the moving of the foreground view.

    that said, you’ll find a implementation here: https://github.com/spilliams/sparrowlike

    the important bits:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"CustomCell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }
    
        // Configure the cell...
        UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
        [panGestureRecognizer setDelegate:self];
        [cell addGestureRecognizer:panGestureRecognizer];
    
        return cell;
    }
    
    #pragma mark - Gesture recognizer delegate
    - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer
    {
        CustomCell *cell = (CustomCell *)[panGestureRecognizer view];
        CGPoint translation = [panGestureRecognizer translationInView:[cell superview] ];
        return (fabs(translation.x) / fabs(translation.y) > 1) ? YES : NO;
    }
    
    #pragma mark - Gesture handlers
    
    -(void)handlePan:(UIPanGestureRecognizer *)panGestureRecognizer
    {
        float threshold = (PAN_OPEN_X+PAN_CLOSED_X)/2.0;
        float vX = 0.0;
        float compare;
        NSIndexPath *indexPath = [self.tableView indexPathForCell:(CustomCell *)[panGestureRecognizer view] ];
        UIView *view = ((CustomCell *)panGestureRecognizer.view).frontView;
    
        switch ([panGestureRecognizer state]) {
            case UIGestureRecognizerStateBegan:
                if (self.openCellIndexPath.section != indexPath.section || self.openCellIndexPath.row != indexPath.row) {
                    [self snapView:((CustomCell *)[self.tableView cellForRowAtIndexPath:self.openCellIndexPath]).frontView toX:PAN_CLOSED_X animated:YES];
                    [self setOpenCellIndexPath:nil];
                    [self setOpenCellLastTX:0];
                }
                break;
            case UIGestureRecognizerStateEnded:
                vX = (FAST_ANIMATION_DURATION/2.0)*[panGestureRecognizer velocityInView:self.view].x;
                compare = view.transform.tx + vX;
                if (compare > threshold) {
                    [self snapView:view toX:PAN_CLOSED_X animated:YES];
                    [self setOpenCellIndexPath:nil];
                    [self setOpenCellLastTX:0];
                } else {
                    [self snapView:view toX:PAN_OPEN_X animated:YES];
                    [self setOpenCellIndexPath:[self.tableView indexPathForCell:(CustomCell *)panGestureRecognizer.view] ];
                    [self setOpenCellLastTX:view.transform.tx];
                }
                break;
            case UIGestureRecognizerStateChanged:
                compare = self.openCellLastTX+[panGestureRecognizer translationInView:self.view].x;
                if (compare > PAN_CLOSED_X)
                    compare = PAN_CLOSED_X;
                else if (compare < PAN_OPEN_X)
                    compare = PAN_OPEN_X;
                [view setTransform:CGAffineTransformMakeTranslation(compare, 0)];
                break;
            default:
                break;
        }
    }
    -(void)snapView:(UIView *)view toX:(float)x animated:(BOOL)animated
    {
        if (animated) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
            [UIView setAnimationDuration:FAST_ANIMATION_DURATION];
        }
    
        [view setTransform:CGAffineTransformMakeTranslation(x, 0)];
    
        if (animated) {
            [UIView commitAnimations];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some problem.. i have created a dynamic button in a table view.
I have a table view with three sections. The first section contains custom cells
Following the documentation on custom cells from a NIB (the Dynamic option), I have
In a View i have a table of users combining data from multiple database
I have a tableview where each cell is populated with dynamic data from an
I have a table with almost 800,000 records and I am currently using dynamic
I am using ASP.NET Dynamic Data for a project and I have a table
I have dynamic array filled with bytes, which are read from .raw file with
how can i know what tableview cell was selected?(being in the detail view) The
I have a table in which I want a dynamic image to load in

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.