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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:20:25+00:00 2026-05-15T00:20:25+00:00

I have a NSTableView that is displaying an array of objects I have. For

  • 0

I have a NSTableView that is displaying an array of objects I have. For each of these objects (rows) I would like to change the color of the text displayed depending on the results of a function I run on each object;

So for example all the object in the table that exist in another list (or some other requirement) I want to display them in green text, and objects that don’t exist display in red.

How would I go about doing this?

  • 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-15T00:20:25+00:00Added an answer on May 15, 2026 at 12:20 am

    Assuming that you have NSTextFieldCell in your table (for other cells, setting text color may vary), you can achieve this by implementing a NSTableView‘s delegate method.

    First, you have to define a delegate for the NSTableView, either in Interface Builder or in your code. This can be your application controller for example.

    Then, just implement the following method:

    - (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
        NSTextFieldCell *cell = aCell;
        if (...) {
            [cell setTextColor:[NSColor greenColor]];
        } else if (...) {
            [cell setTextColor:[NSColor redColor]];
        } else {
            [cell setTextColor:[NSColor blackColor]];
        }
    }
    

    Each time the NSTableView will draw a cell, you have the opportunity to modify it before it get drawn.

    Check out the NSTableViewDelegate documentation page for more details.

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

Sidebar

Related Questions

I have an NSTableView that is displaying different views for each cell. How can
I have an NSTableView which is bound to an NSArrayController. I would like to
I have an NSTableView that I add objects to (through core data). I came
I've got an column of cells in an NSTableView that get their text color
I have an NSTableView that contains a number of items. I'd like to implement
Now that we have NSTableView and NSOutlineView that can have regular NSView objects as
I have a NSTableView that holds a name to all of my NSImageView's, and
I have an NSTableView that contains a few columns that are populated with data.
I have an NSTableView that is done using the typical IB and data bindings.
I have a NSTableView with multiple columns. clicking each of the columns sorts by

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.