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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:30:23+00:00 2026-06-13T23:30:23+00:00

I have a bug. I want to display a UIImageView on cells at special

  • 0

I have a bug.
I want to display a UIImageView on cells at special indexPath.row, but these UIImageView repeat while I scroll.
Exemple: I display my UIImageView on a cell indexPath.row == 0, if I scroll down, I see my UIImageView on the cell at indexPath.row == 8.

Here is my code:

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
            cell = [self getCellContentView:CellIdentifier];

        }

        UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1];
        UIImageView *imgRead = (UIImageView *)[cell viewWithTag:6];

        [cell.contentView insertSubview:imgRead aboveSubview:lblTemp1];

        contentDictio = [dict objectAtIndex:indexPath.row];

        lblTemp1.text = [contentDictio objectForKey:@"title"];

        NSArray *paths_id = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *basePath_id = ([paths_id count] > 0) ? [paths_id objectAtIndex:0] : nil;
        NSString *path_id = [basePath_id stringByAppendingPathComponent:@"id.plist"];

        NSMutableArray *mut_array_id = [[NSArray arrayWithContentsOfFile:path_id] mutableCopy];

        NSMutableDictionary *c0 = [[NSMutableDictionary alloc] init];

        NSString *idPlistData = [contentDictio objectForKey:@"id"];

        for(c0 in mut_array_id) {
            if([[c0 objectForKey:@"id"] isEqualToString:idPlistData]) {
                [imgRead setImage:[UIImage imageNamed:@"read"]];
            }
            else {
            }
        }
    }

    return cell;
}

- (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier {

    CGRect Label1Frame = CGRectMake(kTableCellSmallMargin*2 + 60, kTableCellSmallMargin, 240, 25);

    UILabel *lblTemp;

    UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                                    reuseIdentifier:cellIdentifier] autorelease];

    //Initialize Label with tag 1.
    lblTemp = [[UILabel alloc] initWithFrame:Label1Frame];
    lblTemp.tag = 1;
    lblTemp.backgroundColor = [UIColor clearColor];
    [lblTemp setFont: [UIFont fontWithName:@"HelveticaNeue-CondensedBold" size:15.0]];
    [cell.contentView addSubview:lblTemp];
    [lblTemp release];

    UIImageView *read=[[UIImageView alloc] initWithFrame:CGRectMake(kTableCellSmallMargin, kTableCellSmallMargin, 60, 60)];
    read.backgroundColor=[UIColor clearColor];
    read.tag = 6;
    [cell.contentView addSubview:read];
    [read release];

    return cell;
}

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-13T23:30:25+00:00Added an answer on June 13, 2026 at 11:30 pm

    The cell is cached, so you have to clear it when you want no image, like this:

        BOOL found = NO;
        for(c0 in mut_array_id) {
            if([[c0 objectForKey:@"id"] isEqualToString:idPlistData]) {
                [imgRead setImage:[UIImage imageNamed:@"read"]];
                found = YES;
            }
            else {
    
            }
        }
    
        if (!found)
        {
            [imgRead setImage:nil];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I believe I have found a weird bug as follow: I want to delete
I have been trying to work out the bug on this but can't seem
Microsoft I think this may be a bug. Have a ListView GridView to display
I have some RGBA data in Python 3 and I want to display the
We have a bug to fix, and like any good TDD practitioner, I want
I have bug with UIImagePickerController which source type is camera. Sometimes after controller appeared,
i have bug that i cannot find, i have Class Point with method who
I have a bug in my .htaccess : RewriteCond %{REQUEST_URI} !^(.*)/modalbox/.* RewriteCond %{HTTP_HOST} !^www\.wiglost\.com$
I have a Bug at my simple REGEX. I have been trying to write
I have a bug I'm struggling to track down. I believe what's happening is

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.