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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:08:08+00:00 2026-06-14T13:08:08+00:00

I want to hide a label of a cell in a tableview. (void)handleSwipeRight:(UISwipeGestureRecognizer *)gestureRecognizer

  • 0

I want to hide a label of a cell in a tableview.

(void)handleSwipeRight:(UISwipeGestureRecognizer *)gestureRecognizer
{
    //Get location of the swipe
    CGPoint location = [gestureRecognizer locationInView:self.tableView];

    //Get the corresponding index path within the table view
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];

    //Check if index path is valid
    if(indexPath)
    {
        //Get the cell out of the table view
        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
        //Update the cell or model
        displayLabel.hidden = TRUE;
        [cell setNeedsDisplay];
     }
 }

This code is hiding the label in the last cell as I failed to specify the code to hide the swiped cell’s label.

Help to specify the swiped cell label to hide.

displayLabel.hidden = TRUE;

I need a replacement for this code.

  • 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-14T13:08:09+00:00Added an answer on June 14, 2026 at 1:08 pm

    You can try below code its working perfectly on my side:

    - (void)viewDidLoad
        {
              UISwipeGestureRecognizer *recog = [[UISwipeGestureRecognizer alloc]initWithTarget:self
             action:@selector(handleSwipeRight:)];
              recog.delegate = self;
              [recog setDirection:UISwipeGestureRecognizerDirectionRight];
    
              [testTable addGestureRecognizer:recog];
             // add the swipe gesture recognizer to tableview;
    
    
              [super viewDidLoad];
    
    }
     - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
       {
    
           return 7;
        }
     - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath  
     *)indexPath
      {
        static NSString *CellIdentifier = @"Cell";    
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
         if (cell == nil)
          {
            cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
                 reuseIdentifier:CellIdentifier] autorelease];
           UILabel *aLabel = [[[UILabel alloc]init]autorelease];
           aLabel.frame = CGRectMake(5, 0, 100, 40);
           aLabel.text = [NSString stringWithFormat:@"aLabel %d",indexPath.row+1];
           aLabel.tag = 1;//tag the labels
           [cell.contentView addSubview:aLabel];
    
           UILabel *bLabel = [[[UILabel alloc]init]autorelease];
           bLabel.frame = CGRectMake(110, 0, 100, 40);
           bLabel.text = [NSString stringWithFormat:@"bLabel %d",indexPath.row+1];
           bLabel.tag = 2;//tag the label
           [cell.contentView addSubview:bLabel];
    
           UILabel *cLabel = [[[UILabel alloc]init]autorelease];
           cLabel.frame = CGRectMake(215, 0, 100, 40);
           cLabel.text = [NSString stringWithFormat:@"cLabel %d",indexPath.row+1];
           cLabel.tag = 3;//tag the label
           [cell.contentView addSubview:cLabel];
    
    
          }
    
    
    
          return cell;
        }
    
        -(void)handleSwipeRight:(UISwipeGestureRecognizer *)gestureRecognizer
          {
            //Get location of the swipe
            CGPoint location = [gestureRecognizer locationInView:testTable];
    
           //Get the corresponding index path within the table view
           NSIndexPath *indexPath = [testTable indexPathForRowAtPoint:location];
    
           //Check if index path is valid
            if(indexPath)
              {
                //Get the cell out of the table view
                UITableViewCell *cell = [testTable cellForRowAtIndexPath:indexPath];
               for (id label in  cell.contentView.subviews)
                 {
                    if ([label isMemberOfClass:[UILabel class]]) 
                      {
                        UILabel *referedLabel = (UILabel*)label;
                        if (referedLabel.tag == 2) //tag of bLabel;
                          {
                            referedLabel.hidden = YES;
    
                           }
                        }
                    }
                 }
              }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to hide the label tags in my form input tags of my
I want to hide the download folder location so that when the user downloads
I want to show and hide a label and its control. I can do
I am trying to get a input and textarea label hide/show function to work,
I want to be able to hide a label in my UITableViewCell in order
I want to hide a StopWatch label when its equals to 0, How can
I want to hide a label using the fadeOut effect but when it is
I have Six labels, I want to hide two label's text randomly when a
I want to hide a label if the labels text value is empty. I
I want hide a label according to a dropdown button. I am using a

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.