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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:51:26+00:00 2026-05-14T23:51:26+00:00

I have a very strange problem with a UITableview within a navigation controller on

  • 0

I have a very strange problem with a UITableview within a navigation controller on the iPhone simulator. Of the cells displayed, only some are correctly rendered. They are all supposed to look the same but the majority are missing the accessory I’ve set, scrolling the view changes which cell has the accessory so I suspect it’s some sort of cell caching happening, although the contents are correct for each cell. I also set an image as the background and that was also only displaying sporadically but I fixed that by changing

cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]];

(which also only rendered a random cell with the background) to

cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]];

I now need to fix the problem with the accessory only showing on a random cell. I tried moving the code from cellForRowAtIndex to willDisplayCell but it made no difference. I put in a log command to confirm that it is running through each frame.

Basically it’s a table view (UITableViewCellStyleSubtitle) that gets its info from a server & is then updated by a delegate method calling reload. Code is:

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
  NSLog(@"%@", [NSString stringWithFormat:@"Setting colours for cell %i", indexPath.row]);

  // Set cell background
  // cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
  cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow-bar_short.png"]];
  cell.textLabel.backgroundColor = [UIColor clearColor];
  cell.detailTextLabel.backgroundColor = [UIColor clearColor];

      // detailTableViewAccessory is a view containing an imageview in this view's nib
      // i.e. nib <- view <- imageview <- image
  cell.accessoryView = detailTableViewAccessory;
}

// Called by data fetching object when done
-(void)listDataTransferComplete:(ArticleListParser *)articleListParserObject
{
  NSLog(@"Data parsed, reloading detail table");
  self.currentTotalResultPages = (((articleListParserObject.currentArticleCount - 1) / 10) + 1);
  self.detailTableDataSource = [articleListParserObject.returnedArray copy]; // make a local copy of the returned array

  // Render table again with returned array data (neither of these 2 fixed it)
  [self.detailTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  // [self.detailTableView reloadData];

  // Re-enable necessary buttons (including table cells)
  letUserSelectRow = TRUE;
  [btnByName setEnabled:TRUE];
  [btnByPrice setEnabled:TRUE];

  // Remove please wait message
  NSLog(@"Removing please wait view");
  [pleaseWaitViewControllerObject.view removeFromSuperview];
}

I only included code that I thought was relevant, can supply more if needed. I can’t test it on an iPhone yet so I don’t know if it’s maybe just a simulator anomaly or a bug in my code. I’ve always gotten good feedback from questions, any ideas?

  • 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-05-14T23:51:27+00:00Added an answer on May 14, 2026 at 11:51 pm

    Resolved! What I thought was a rendering problem was actually just a stupidity problem on my part (serves me right for blindly following a tutorial). IB was only creating one instance of the accessory view which was being assigned to one cell. Fixed it by recreating the view on each cell creation:

    cell.accessoryView = detailTableViewAccessory;
    

    replaced by

    UIImageView *cellAccessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(308, 0, 12, 75)];
    cellAccessoryView.image = [UIImage imageNamed:@"blue-accessory-pointer.png"];
    [cell.contentView addSubview:cellAccessoryView];
    [cellAccessoryView release];
    

    I should also add that the issue I had with the cell background was fixed with the same methodology. Also, in place of the addSubview line you could use

    cell.accessoryView = cellAccessoryView;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have very strange problem and maybe some of you could help my.
I have a very strange problem. Under some elusive circumstances I fail to apply
I have a very strange problem in my app which only happen on Retina
I have very strange problem while I am submitting a practice problem on codechef.
I have a very strange problem when I'm testing my application on device. I
I have a very strange problem. I have a working WCF service. [ServiceContract] public
I have a very strange problem with using geometry shaders. I made a very
I have a very strange problem in which identical pieces of Javascript are behaving
I use the memcache extension for python, and I have a very strange problem.
I experience a very strange problem and I don't have found any help to

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.