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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:35:51+00:00 2026-06-01T12:35:51+00:00

In my iPhone app I have a table view where I add a tick

  • 0

In my iPhone app I have a table view where I add a tick image to a cell if that objects ‘isConfirmed’ value is true. When entering the detailed view I can edit the confirmed value, and upon popping back to the main table view I need to see the update and not only when I view the main table from a fresh.

So I am using this code in my tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method`:

UIImageView *tickImg = nil;

    //If confirmed add tick to visually display this to the user
    if ([foodInfo.isConfirmed boolValue])
    {
        tickImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ConfirmedTick.png"]];
        [tickImg setFrame:CGRectMake(0, 0, 32, 44)];
        [cell addSubview:tickImg];
    }
    else 
    {
        [tickImg removeFromSuperview];
    }

What this does it successfully add the tick image to my cells which have a true value for isConfirmed and when going into the detail view of an object and setting it to TRUE and retuning, the tick appears, however I can’t get it to work the other, so if the tick is there and I go into the detail view to unconfirmed it, the tick doesn’t disappear.

  • 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-01T12:35:52+00:00Added an answer on June 1, 2026 at 12:35 pm

    Are you calling [self.tableView reloadData]; on the VC’s viewWillAppear:?

    Also, the approach you’re using to configure the cell is error-prone. Since the tableView is reusing the cells, you can’t be sure what state a cell is in when you dequeue it.

    A better approach would be to build the cells consistently:

    static NSString *CellIdentifier = @"MyCell";
    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    
        // always create a tick mark
        UIImageView *tickImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ConfirmedTick.png"]];
        tickImg.tag = kTICK_IMAGE_TAG;
        tickImg.frame = CGRectMake(0, 0, 32, 44);
        [cell addSubview:tickImg];
    }
    
    // always find it
    UIImageView *tickImg = (UIImageView *)[cell viewWithTag:kTICK_IMAGE_TAG];
    
    // always show or hide it based on your model
    tickImg.alpha = ([foodInfo.isConfirmed boolValue])? 1.0 : 0.0;
    
    // now your cell is in a consistent state, fully initialized no matter what cell
    // state you started with and what bool state you have
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my iPhone app, In Table view I have Two labels in one cell..
I have a working table view on my iphone app, and am implementing a
I have an iPhone app which has a Table View-based data input screen with
I have an iPhone app that hides the status bar. However, my main view
I want to add a custom table to my iPhone app, that should look
For my iPhone app, I have an editable (for delete) table view. I'd like
i my iphone app while assigning a string value to the table view its
I have a simple iphone app that's based on the CrashLanding sample app. So
I have an iPhone app that compiles and runs fine in the Simulator on
I have a iPhone app that I'm working on and it works alot like

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.