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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:14:01+00:00 2026-05-13T09:14:01+00:00

I have a NSTreeController which array is bound to a items (custom) property of

  • 0

I have a NSTreeController which array is bound to a “items” (custom) property of an NSArrayController subclass.
As the tree controller is not bound to the selection of the NSArrayController I need to make sure to let the tree controller know that items has to be fetched after the selection of the array controller changes.

I have done the following in a subclass of NSArrayController:

+ (NSSet *)keyPathsForValuesAffectingItems
{
    return [NSSet setWithObjects:@"selectedObjects",nil];
}

Which should be sufficient AFAIK. The class method is called but does not seems to have any effect.

If I implement an observer for selectedObjects it works fine:

- (void)awakeFromNib;
{
    [self addObserver:self forKeyPath:@"selectedObjects" options:0 context:nil];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(NSObjectController *)context;
{
    if ([keyPath isEqual:@"selectedObjects"]) {
        [self willChangeValueForKey:@"items"];
        [self didChangeValueForKey:@"items"];
    }

    [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}

Any clue?

  • 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-13T09:14:01+00:00Added an answer on May 13, 2026 at 9:14 am

    First, “items” is not an observable property of NSArrayController. Do you mean it’s a property of the class for which your array controller manages a collection? Ie, it manages an array of Foo and Foo has a property “items”?

    In any case, you’re making this harder than it needs to be. Why not just go ahead and bind the tree controller’s contents to the array controller’s selection.items path? There are few situations where this isn’t possible.

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

Sidebar

Ask A Question

Stats

  • Questions 298k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Change your anchors to use the onclick event instead of… May 13, 2026 at 7:36 pm
  • Editorial Team
    Editorial Team added an answer $subject = "<h1>hithere</h1>\nbut this other\nnewline should be replaced."; $new =… May 13, 2026 at 7:36 pm
  • Editorial Team
    Editorial Team added an answer You can configure your application to use specific versions of… May 13, 2026 at 7:36 pm

Related Questions

I have an outline view and a button. I want the button to remove
I have a non document-based Core Data application. There's an NSTreeController that manages a
The problem I have is that I have an NSOutlineView with Drag and Drop
I have an outline view with 2 entities being displayed inside it so It
I have now nearly figured out how to Filter a NSTreeController, to do this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.