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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:39:20+00:00 2026-06-18T08:39:20+00:00

I am attempting to call a reloadData on my table’s rows on a viewDidAppear

  • 0

I am attempting to call a reloadData on my table’s rows on a viewDidAppear method access. However, my cells are not refreshing their values and I cannot figure out why, as it seems everything is being accessed in the order it is suppose to. To make matters more odd, 1 row actually does refresh, but none of the others do.

Here is my code…

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{     
  // Set up the cell...
  static NSString *CellWithIdentifier = @"Cell";
  UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
  NSLog(@"generating cell contents");
if (cell == nil)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellWithIdentifier];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = [_tableGroup.options objectAtIndex:rowcount];
    rowcount++;

    //label for currently selected/saved setting
    _currentSetting = [[UILabel alloc] initWithFrame:CGRectMake(160, 8, 115, 25)];
    [_currentSetting setFont:[UIFont systemFontOfSize:14]];
    _currentSetting.backgroundColor = [UIColor clearColor];
    _currentSetting.textColor = [UIColor blueColor];
    _currentSetting.textAlignment = NSTextAlignmentRight;


    [cell.contentView addSubview:_currentSetting];
    NSLog(@"added new label to cell");
}

//depending on the setting, set the label in the cell to what is currently selected
if (indexPath.section == 1 && indexPath.row == 0) {
    _currentSetting.text = [NSString stringWithFormat:@"%@ %@",[settings.mapDistance stringValue], NSLocalizedString(@"MILES_IDENTIFIER", nil)];
    NSLog(@"setting map distance label: %@", settings.mapDistance);
}
else if(indexPath.section == 1 && indexPath.row == 1)
{
    _currentSetting.text = [NSString stringWithFormat:@"%@ %@",[settings.maxCustomers stringValue], NSLocalizedString(@"ITEMS_IDENTIFIER", nil)];
    NSLog(@"setting max customers: %@", settings.maxCustomers);
}
else if(indexPath.section == 2)
{
    _currentSetting.text = [NSString stringWithFormat:@"%@ %@",[settings.maxProducts stringValue], NSLocalizedString(@"ITEMS_IDENTIFIER", nil)];
    NSLog(@"setting max products: %@", settings.maxProducts);
}

return cell;
}

based on this code, i get this output with my NSLOGS.

this is the first run of the cells when the view is created. It generates 4 cells, puts labels in each cell, and in 3 of those labels, puts in a value.

 generating cell contents
 added new label to cell
 generating cell contents
 added new label to cell
 setting map distance: 15
 generating cell contents
 added new label to cell
 setting max customers: 250
 generating cell contents
 added new label to cell
 setting max products: 150

at this point i have clicked a row, went to a different screen, and have now returned. as you can see, map distance is different. although no change is displayed, even though the code to change the label’s text is accessed during the reload process.

 reloading data
 generating cell contents
 generating cell contents
 setting map distance: 25
 generating cell contents
 setting max customers: 250
 generating cell contents
 setting max products: 150

again, I’m at a loss because the last row DOES refresh correctly. But none of the others do.

Thanks

  • 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-18T08:39:21+00:00Added an answer on June 18, 2026 at 8:39 am

    When you reload your tableView, the cells already exist and are dequeued from the tableView, so the condition if (cell == nil) returns false, and the cell creation code is not executed.

    In that cell creation code, you are assigning a value to _currentSetting and then proceed with the acode assuming that value is correct. However, when the cell creation code is not executed, that value points to the latest created cell, and thus, it won’t update.

    To fix this: make _currentSetting a local variable and change the code to look like this:

    (You don’t really need to make it a local variable, but it’s more appropriate because you don’t really need a reference to the last label you created after you leave this method)

    UILabel *_currentSetting = nil;
    if (cell == nil) {
        _currentSetting = ...
        _currentSetting.tag = 123;
    }
    else
        _currentSetting = [cell.contentView viewWithTag:123];
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to call the Apache Commons StringUtils.join() method from within a Groovy
I'm using ASP.NET and attempting to call a method with a signature of [WebMethod]
I'm attempting to build a method call from strings that have been passed into
I'm attempting to call a method written in C++/CLI from C#. The C++/CLI code
I'm attempting to call a method which is outside the class I'm working in
Using symfony2. I have a listener class that is attempting to call a method
I am attempting to call SQL stored procedure that does an INSERT. However, when
attempting to call a method for creating a display container for the xmlhttp.responseText;//createDisplayElement() In
I'm attempting to call a method from a base class with the same name
I'm attempting to call a constructor method that looks like: public static SomeWrapper<T> method(Class<T>

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.