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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:47:31+00:00 2026-06-17T17:47:31+00:00

I am toggling a background image on a UITableViewCell on a right swipe. The

  • 0

I am toggling a background image on a UITableViewCell on a right swipe. The problem is that if I add [taskManager reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationRight]; it will only toggle once but then not toggle back. So why is this? What will make this not happen? Here is the whole method code.

- (void)handleSwipeRight:(UISwipeGestureRecognizer *)gestureRecognizer {
CGPoint location = [gestureRecognizer locationInView:self.taskManager];

NSIndexPath *indexPath = [self.taskManager indexPathForRowAtPoint:location];

[taskManager reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationRight];

UIImage *notCkDone = [UIImage imageNamed:@"UITableViewCellCheckmark"];
UIImage *isCkDone = [UIImage imageNamed:@"UITableViewCellCheckmarkDone"];

UIImage *notBgDone = [UIImage imageNamed:@"UITableViewCell"];
UIImage *isBgDone = [UIImage imageNamed:@"UITableViewCellDone"];

UITableViewCell *cell = [taskManager cellForRowAtIndexPath:indexPath];

if (indexPath) {
    if (cell.imageView.image == notCkDone) {
        cell.imageView.image = isCkDone;
        cell.backgroundView = [[UIImageView alloc] initWithImage:isBgDone];
    } else {
        cell.imageView.image = notCkDone;
        cell.backgroundView = [[UIImageView alloc] initWithImage:notBgDone];
    }
    cell.textLabel.textColor = [UIColor colorWithRed:0.0/0.0 green:0.0/0.0 blue:0.0/0.0 alpha:1.0];
}

}

  • 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-17T17:47:32+00:00Added an answer on June 17, 2026 at 5:47 pm

    All changes to the visuals of your cells should happen inside your tableView:cellForRowAtIndexPath:. You should not do it in the event handler of your gesture recognizer (or anywhere else outside the tableView:cellForRowAtIndexPath, for that matter).

    The gesture recognizer needs to alter the model behind your table view, so that your tableView:cellForRowAtIndexPath could make a decision to set the image to notCkDone or isCkDone the next time the data is reloaded, and also deal with the background changes. Then your gesture recognizer should tell the table view to reload the data.

    Your current solution operates on cells returned by tableView:cellForRowAtIndexPath. When you change the visuals from the outside, the table view shows the change while the cell is on screen. However, when the cell scrolls off the screen, it gets recycled, meaning that the next time you dequeue a cell with cell identifier you may get an object that used to display as a different cell.

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

Sidebar

Related Questions

I am having a problem toggling some content that was clicked.The two items are
I have a complicated background image with a lot of small regions that need
I have a navigation bar that when hovering over an item, the background image
I'm using Unobtrusive Toggling in a view that contains many records (Orders). I've got
I had an accordion given to me that is not toggling each tab open
(Jquery) I have two divs that I'm toggling back and forth (show and hide)
I'm toggling the datasource of an tableview but the indexPath.row throws me an exception
I have a div that can display 3 images (in the background) each indicating
Hi I am having trouble with toggling a check box that is in a
Hello people i have problem with jquery toggling script.. <a class=clickMe>Text 1</a> </br> <div

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.