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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:04:50+00:00 2026-05-14T03:04:50+00:00

I have a full list that populates a UITableView . This I want to

  • 0

I have a full list that populates a UITableView. This I want to background the one of the cells with a different color and it works initially, but for some reason when I start scrolling the table up and down, it starts drawing more cells with the green background.

Please note that there is always one detailCell.detailTimeLabel.text that’s equal to currentTime.

The code I have is:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

... SOME MORE CODE HERE ...

        if ([detailCell.detailTimeLabel.text isEqualToString:currentTime]) {  
            UIView* backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
            backgroundView.backgroundColor = [UIColor greenColor];
            detailCell.backgroundView = backgroundView;
            for (UIView* view in detailCell.contentView.subviews) 
            {
                view.backgroundColor = [UIColor clearColor];
            } 
        }   
    }

Which can be the problem?

  • 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-14T03:04:50+00:00Added an answer on May 14, 2026 at 3:04 am

    Your trying to store data in a tableviewcell. You can’t do this because the cells are constantly reused. The background you see repeated occurs because its the same cell being displayed over and over again with different text.

    When you dequeue the cell, you need to reset it to blank and wipe out all the previous data. Then you should set the background color only if the data you are putting into the cell has the current time.

    As a general rule, you should never refer to data in the cells. If you need to know what is in a particular cell, look at the data at the indexpath within the datamodel itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combobox that populates with a list of addresses: this.entityAddressField = new
I have an array that looks like this (the full list is here ):
I have a list of nodes that I want to present to the user.
i have this full code: program List; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Generics.Collections;
I have two tables, one containing a list of different options users can select
I have a form containing a list of input fields that the user populates
I have a guest list that has a last name in one column and
If I have Full Control permission on a list, is there a way for
Does Microsoft Access have Full Text Search? I know that MySQL and SQL Server
In my live site I have php include() and require() that have full path

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.