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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:48:57+00:00 2026-06-15T11:48:57+00:00

I have a problem with my tableview. Let me first sketch the situation. I

  • 0

I have a problem with my tableview. Let me first sketch the situation. I have a view with on top 2 buttons (Calendar and Ranking). Below this two buttons I have a tableview. When I press on a button I set the tableview's tag ( 1 or 2 ) and I reload the tableview’s data.

In my ranking I am making one specific cell’s text color blue. But when I refresh, other cell’s texts are going blue.

Now for my cellForRowAtIndex I have a lot of code. Because I don’t know excactly where the problem is I will post all the code over here. I hope you don’t bother.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //standard cell
    static NSString *simpleTableIdentifier = @"KalenderCell";
    KalenderCell *cell = (KalenderCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if ((cell == nil) || (![cell isKindOfClass:KalenderCell.class]))
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"KalenderCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }

    //Cells for button 2
    if(self.tableView.tag == 2){
        static NSString *simpleTableIdentifier = @"KlassementCell";

        KlassementCell *cell = (KlassementCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
        if ((cell == nil) || (![cell isKindOfClass: KlassementCell.class]))
        {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"KlassementCell" owner:self options:nil];
            cell = [nib objectAtIndex:0];
        }

        Klassement *klassement = [self.fetchedResultsController objectAtIndexPath:indexPath];
        NSData *dataIcon = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:klassement.icon]];
        UIImage *imgIcon = [UIImage imageWithData:dataIcon];


        cell.lblPosition.text       = klassement.position;
        cell.lblName.text           = klassement.name;
        cell.lblgamesPlayed.text    = klassement.gamesPlayed;
        cell.lblGamesWon.text       = klassement.gamesWon;
        cell.lblGamesTied.text      = klassement.gamesTied;
        cell.lblGamesLost.text      = klassement.gamesLost;
        cell.lblGoalsPos.text       = klassement.goalsPos;
        cell.lblGoalsNeg.text       = klassement.goalsNeg;
        cell.lblGoalsDiff.text      = [NSString stringWithFormat:@"%@", klassement.goalsDiff];
        cell.lblPoints.text         = klassement.points;
        cell.imgClub.image          = imgIcon;

        if([klassement.name isEqualToString:@"KRC Genk"]){
            cell.lblPosition.textColor      = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblName.textColor          = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblgamesPlayed.textColor   = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGamesTied.textColor     = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGamesLost.textColor     = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGoalsDiff.textColor     = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGoalsNeg.textColor      = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGoalsPos.textColor      = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblPoints.textColor        = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            cell.lblGamesWon.textColor      = [UIColor colorWithRed:(56/255.0) green:(119/255.0) blue:(189/255.0) alpha:100] ;
            return cell;
        }

        return cell;

        //Cells for button 1
    }else if(self.tableView.tag == 1){
        static NSString *simpleTableIdentifier = @"KalenderCell";

        KalenderCell *cell = (KalenderCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
        if ((cell == nil) || (![cell isKindOfClass:KalenderCell.class]))
        {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"KalenderCell" owner:self options:nil];
            cell = [nib objectAtIndex:0];
        }

        Kalender *kalender = [self.fetchedResultsController objectAtIndexPath:indexPath];

        NSData *imgDataHome = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:kalender.homeIcon]];
        NSData *imgDataAway = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:kalender.awayIcon]];

        UIImage *imgHome = [UIImage imageWithData:imgDataHome];
        UIImage *imgAway = [UIImage imageWithData:imgDataAway];

        // Then configure the cell using it ...
        if([kalender.type isEqualToString:@"JPL"]){
            _imgType = [UIImage imageNamed:@"jupiler.png"];
        }else if ([kalender.type isEqualToString:@"EU"]){
            _imgType = [UIImage imageNamed:@"europa.jpg"];
        }else {
            _imgType = nil;
        }

        cell.lblHome.text           = kalender.home;
        cell.lblHomeScore.text      = kalender.homeScore;
        cell.lblAwayScore.text      = kalender.awayScore;
        cell.lblAway.text           = kalender.away;
        cell.lblDate.text           = kalender.date_text;
        cell.lblHour.text           = kalender.hour;
        cell.img_Home.image         = imgHome;
        cell.img_Away.image         = imgAway;
        cell.img_type.image         = _imgType;


        return cell;
    }


    return cell;

}

Another problem is that sometimes cells are duplicating itself inside the tableview for 2 or 3 times but when I refresh they tableview is back OK.

I know this is a lot of code. But I hope you want to help me!

Kind regards, and many thanks in advance !

Screen with the problem

enter image description here

  • 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-15T11:48:58+00:00Added an answer on June 15, 2026 at 11:48 am

    on bellow condition you set blue color

        if([klassement.name isEqualToString:@"KRC Genk"]){
          /// set blue color 
        }
    

    as it is add else part with black color

    like bellow…

             else{
                cell.lblPosition.textColor      = [UIColor blackColor] ;
                cell.lblName.textColor          = [UIColor blackColor] ;
                cell.lblgamesPlayed.textColor   = [UIColor blackColor] ;
                cell.lblGamesTied.textColor     = [UIColor blackColor] ;
                cell.lblGamesLost.textColor     = [UIColor blackColor] ;
                cell.lblGoalsDiff.textColor     = [UIColor blackColor] ;
                cell.lblGoalsNeg.textColor      = [UIColor blackColor] ;
                cell.lblGoalsPos.textColor      = [UIColor blackColor] ;
                cell.lblPoints.textColor        = [UIColor blackColor] ;   
                cell.lblGamesWon.textColor      = [UIColor blackColor] ;
                return cell;
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem with a tableview in iOS5 that is giving me errors,
I have a problem loading different nib files in one tableView. I saw this
Let me describe my problem first. I have a class which holds a NSMutableDictionary
I have a problem with my tableview. My first problem is that I have
I have problem with TableView its empty. In (.h) file: @interface TableViewController : UITableViewController{
I have a problem while scrolling images on tableview. I am getting a Signal
I have encountered a problem of placing data into the Table View. Here is
I have problem with my query on C, I’m using the oci8 driver. This
It's the first time I'm trying to use TableView in iOS and have an
OK so I have two entities in my data model (let's say entityA and

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.