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

  • Home
  • SEARCH
  • 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 8135915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:34:38+00:00 2026-06-06T10:34:38+00:00

I have a large custom UITableView with UILabels in each row, and I’d like

  • 0

I have a large custom UITableView with UILabels in each row, and I’d like to display certain texts in Black or Green color.

I feed the cells with the NSString's from a NSArray. Suppose I want to display in black only the the NSString from index 30.

I’m Trying something like this, but it’s not working:

NSIndexPath *indexPathWithBlackText = [NSIndexPath indexPathForRow:30 inSection:[indexPath section]];

    if (indexPath.row == indexPathWithBlackText.row) {  
        //Label with text in black 
        topLabel.textColor = [UIColor colorWithRed:0.25 green:0.0 blue:0.0 alpha:1.0];
        topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
    } else {
        //Label with text in green 
        topLabel.textColor = [UIColor colorWithRed:0.122 green:0.467 blue:0.255 alpha:1.00];
    }

Any hints on the right direction will be much appreciated. 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-06T10:34:40+00:00Added an answer on June 6, 2026 at 10:34 am

    In this UITableViewDataSource delegate method:

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

    Write this:

    if ([self isBlackRow:indexPath.row]) {
        // Your label reference, change color to black here.
    } else {
        // Your label reference, change color to green here. 
    }
    

    Make a method to determine if the row is black or not

    - (BOOL)isBlackRow:(NSInteger)row {
        NSArray* blackRows = [NSArray arrayWithObjects:[NSNumber numberWithInt:30], [NSNumber numberWithInt:11], nil];
    
        for (NSNumber* number in blackRows) {
            if (number.intValue == row) {
                return YES;
            }
        }
    
        return NO;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large data set and I want to write a custom merge
I have large images displayed in a grouped tableview. I would like the images
I have a large image and I want to make certain sections of the
I have a label label1 in the middle left of a large custom panel
I have a large database, and I want to dump the data after custom
I have a large string containing a custom HTML tag (xxx). The tag also
I have a large table of text inputs for which a set of custom
I have a large directory structure with JavaScript, images, etc. that depend on each
I have a custom animation involving sliding 3 UIView s past one another. Each
I have a large dataset (~1GB) stored in a custom file format, the last

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.