• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to programatically add an item to an array that has an NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to programatically add an item to an array that has an NSArrayController


  • Subject: How to programatically add an item to an array that has an NSArrayController
  • From: Steve Israelson <email@hidden>
  • Date: Mon, 21 Mar 2005 22:09:34 -0800

Hi.
Just getting going on the use of controllers.
I see questions similar to this answered, but yet I can't quite get the solution.


I have a simple problem, it seems to me :)
I have my main object, a Document.
This contains an array, of objects, call them "Object_A".
Each "Object_A" also contains an array of objects "Object_B" that has properties.


Very similar to the "Mailbox" sample code on CocoaDev or somewhere.

Now i have a set of two tables and a detail view, and they are hooked up to two NSArray controllers.
Using little "+" and "-" UI buttons, this works fine.


What I need is a way to add an item to each array via another object.
This object is responding to a user even and is wanting to make new items for these arrays.


What I have done is added a method to my document/view controller to do this.
I put an outlet in this controller, which is the files owner, for the NSArrayController, tho I have found no use for this yet :)


If I add items to the array using addObject:, then they are added, but the UI does not update.
If I then use the "+" button, then the UI updates and there are 2 items, my added one and this fresh one.


I see I need to use some sort of key value method to add the object to the array, but I can;t figure out what it might be.
I thought the controller could make a new object and return it to me, but it does not appear to be able to.


Maybe I am going about this all wrong.

While awaiting suggestions I am going to do some more tutorials on this.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to programatically add an item to an array that has an NSArrayController
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Path To Folder Where App Is
  • Next by Date: Re: Path To Folder Where App Is
  • Previous by thread: Re: Inspector window
  • Next by thread: Re: How to programatically add an item to an array that has an NSArrayController
  • Index(es):
    • Date
    • Thread