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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:56:04+00:00 2026-05-26T12:56:04+00:00

I am trying to implement pretty much the simplest case of binding a NSTableView

  • 0

I am trying to implement pretty much the simplest case of binding a NSTableView to a NSArrayController, so that the NSTableView is backed by an NSArray.

Here is the setup:

  1. I have an NSArrayController whose ‘Content Array’ is bound to an NSArray in my app delegate.
  2. In ‘Object Controller’ of the NSArrayController, the class name is set to Model, the type of objects contained in the NSArray.
  3. The ‘Value’ of the single column of the NSTableView is bound to key ‘name’ of ‘arrangedObjects’ of the Array Controller, which is the only field of the Model class.
  4. In applicationDidFinishLaunching: of my app delegate, I initialise the NSArray, and insert some Model objects.

However, the rows corresponding to Model do not appear in the table unless I also do: [self.arrayController setContent: self.array].

Is there a way I can get this to work using bindings wired up in Interface Builder? I would have expected the fact that the NSArrayController’s ‘Content Array’ is bound directly to the NSArray to mean that I wouldn’t have to set the content programmatically. Knowing why would help me understand bindings better.

  • 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-26T12:56:04+00:00Added an answer on May 26, 2026 at 12:56 pm

    Your array controller is observing your App Delegate’s “array” property. That means KVO notifications are sent only when the array object is set, not when objects are added to it. It sounds like you are using an NSMutableArray and adding objects to it, which explains why the Array Controller is not being notified of changes, because the underlying object is not changing.

    The easy solution is to wrap your calls in a will/did change block like so:

    [self willChangeValueForKey:@"array"];
    [self.array addObject:[NSDictionary dictionaryWithObject:@"foo" forKey:@"name"]];
    [self.array addObject:[NSDictionary dictionaryWithObject:@"bar" forKey:@"name"]];
    [self didChangeValueForKey:@"array"];
    

    This manually notifies observers that there has been a change to the “array” property.

    Long answer: You’re doing it wrong. The whole point of having an array controller is to shift the work of managing the array to the controller class itself, so it manages the underlying array, sends out the right notifications, maintains state, etc. without you having to sweat the implementation details. A better solution would be to unhook the content array binding and just add objects to the array controller directly like so:

    [arrayController addObject:[NSDictionary dictionaryWithObject:@"foo" forKey:@"name"]];
    [arrayController addObject:[NSDictionary dictionaryWithObject:@"bar" forKey:@"name"]];
    

    This works because the array controller manages its own array internally.

    The best solution is to use Core Data. NSArrayController is designed to be used with it. You also get a whole bunch of things for free, like persistentce, undo support, object relationsips, and the ability to add objects without writing code just by calling add: on the array controller directly from your UI controls.

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

Sidebar

Related Questions

I'm pretty much a newb with spring-hibernate and I have been trying to make
I have a pretty specific question. I am trying to implement an onclick and
I'm having an issue with a binding that I'm trying to implement. It will
when trying to implement an Aspect, that is responsible for catching and logging a
I've been following the Searchable Dictionary example pretty carefully as I'm trying to implement
I'm trying to write a game and implement scripting so that later on in
In case my initial approach is wrong, here's what I'm trying to accomplish. I
I am trying to implement pagination in my search results with Yii. I have
I'm trying to implement the above mentioned. From this link, http://www.pocketmagic.net/?p=1870 , it pretty
I've been trying to implement what should be a pretty simple feature, but I'm

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.