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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:26:32+00:00 2026-05-13T20:26:32+00:00

Sorry for the clumsy title. Imagine a simple UI to display the first names

  • 0

Sorry for the clumsy title.

Imagine a simple UI to display the first names of a person’s children…

As I initially only had one Person, I created an array controller and bound it to appDelegate.person1.children – this worked fine, as did binding a table column to display the first names.

However, I have since extended my program so that rather than a ‘person1’ there is an array or people maintained in the AppDelegate. I figured that I could simply keep the person1 attribute however, and use it to return the first item in the list:

- (Person *)person1{
    return [[self people] objectAtIndex:0];
}

I have confirmed everything is created correctly (during runtime), but I can’t get the bound table column to display the first names of person1’s kids.

Something to with KVO? How do I make sure that the table knows that when the persons array changes, person1 changes (and therefore the UI)?

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-05-13T20:26:33+00:00Added an answer on May 13, 2026 at 8:26 pm

    How do I make sure that the table knows that when the persons array changes, person1 changes (and therefore the UI)?

    You mean the value of the person1 property is dependent on the value of the persons property. The former, then, is what’s called a dependent key.

    So, implement keyPathsForValuesAffectingPerson1 to return a set containing @"persons".

    You also need to change the value of the property in an observable manner. Talking to the array directly won’t cut it; nothing will know the value has changed. As Raj Pawan already noted, one way would be to explicitly send whole-value value-will/did-change notifications yourself.

    The other way, which I find much easier to read and to write, is to implement array accessor methods for the array property (in your case, the persons property), and exclusively use these accessors to mutate the array (outside of init and dealloc). When you call your accessors, KVO notifications happen for free. This should include any dependent keys as well.

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

Sidebar

Related Questions

(sorry about the long title) I have a custom object Person, which in turn
Sorry if this is a simple question, but I've only recently started learn coding
Sorry about the confusing title, I had a hard time describing the problem. I
Sorry about the non-descriptive title; Had no Idea how to put it. So when
Sorry for a long question and not a very descriptive title, but my problem
Sorry, I'm sure this is simple but I'm tired and can't figure it out.
Sorry for the unhelpful title, but hopefully I can explain this well enough. Lets
Sorry if the title doesn't make sense. Basically I have a series of strings
Sorry for the non-descript title, but I'm having a hard way with words right
Sorry for the bad title but it's a little complicated to get across in

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.