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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:28:41+00:00 2026-05-28T19:28:41+00:00

I read that because of the dequeueReusableCellWithIdentifier method grabbing an oldCell if there is

  • 0

I read that because of the dequeueReusableCellWithIdentifier method grabbing an oldCell if there is one available to use rather than creating a new one, if I have special views to show, like images or checkmarks, that I want to explicitly say, show = YES or show = NO for the cell so the cell doesn’t end up using a cell with an old graphic on it and I end up getting an image I don’t want on my view.

So in this case, I have a UITableView inside a popover. It is a grouped table. The groups have 2-4 cells depending on the data. I am using the UITableViewCellStyleValue2 like the contacts application. I want to add an image to the right side of the cell on the first cell in the group only depending on the data. It works, however, once I scroll the table, it picks up a dequeued cell and then I’ll get one of the images on the right hand side for a cell that is not even the first cell. I did not create a UITableViewCell subclass, and am unsure if I need to add this point so I have control over the imageView I’m adding to the cell.

So here’s the important part of the cellForRowAtIndexPath method:

if (row == 0) {
    UIImage *dot;
    if (aTarget.importance == TargetImportanceHigh) {
        dot = [UIImage imageNamed:@"dot_red.png"];
    }
    else if (aTarget.importance == TargetImportanceLow) {
        dot = [UIImage imageNamed:@"dot_yellow.png"];
    }
    else {
        dot = [UIImage imageNamed:@"dot_black.png"];
    }
    UIImageView *imgView = [[UIImageView alloc] initWithImage:dot];
    imgView.frame = CGRectMake(cell.frame.size.width - 50, cell.frame.size.height / 2 - 7.5, 15, 15);
    [cell.contentView addSubview:imgView];
    [imgView release];

    cell.textLabel.text = @"Location
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%i", aTarget.location];
}
else if (row == 1) {
    cell.textLabel.text = @"Coordinate";
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", aTarget.coordinate];
}
return cell;
  • 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-28T19:28:42+00:00Added an answer on May 28, 2026 at 7:28 pm

    You should do this via a UITableViewCell subclass, and then you can clear your second UIImageView in prepareForReuse

    e.g.

    @implementation MyTableViewCellSubclass
    
    
    // other methods
    // ...
    
    - (void)prepareForReuse {
        [super prepareForReuse];
    
        self.otherImageView.image = nil;
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read that LinkedHashMap has faster iteration speed than HashMap because its elements
I have read that a variable should never do more than one thing. Overloading
I've read that to optimize page load, you should use one css and one
I recently read that in newer computers Java's I/O performs better than NIO because
I want to use a grid as subgrid in jqGrid because I read that
I read that defined styles are located at C:\Program Files\Microsoft Office\Office12\Bibliography\Style I use ISO
I just read that Android has a 450% performance improvement because it added a
I have read that placing a canvas inside a scrollviewer won't work because the
I have read that I can use asynchronous call with polling especially when the
I somewhat confused because I've read that everything should be possible at IRQL_PASSIVE, but

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.