• 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
Re: NSPersistentDocument arrayController Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPersistentDocument arrayController Data


  • Subject: Re: NSPersistentDocument arrayController Data
  • From: Charilaos Skiadas <email@hidden>
  • Date: Fri, 5 Aug 2005 18:10:22 -0500

On Aug 5, 2005, at 5:05 PM, Ian McGregor wrote:

Hi Harris,

What I am wish to do, is update some of the records in the controlled array, based on an external file each time the document is opened. Lets say the array contains a list of products for a store. When the document is first opened, a field in the products class is checked against more current values in this external file (say product quantity). In reality there will be several fields which will be checked.

So, this external file could change during the run-time of your app too?
In that case, shouldn't the app check for the changes occasionally during the run also?
Maybe you could subclass NSArrayController, and override arrangedObjects instead in that case.
At the moment I am having to use a button in the document's window to activate a function to perform this check, once the document has loaded. In a previous version of this application (prior to core data and bindings), this was all done an an ordinary NSMutableArray instance variable of my document class and a function call in windowControllerDidLoadNib.

I can definitely confirm that the contents have not been updated in windowControllerDidLoadNib. The controller is there, but it is empty. Personally, all I expect in that method is that all the objects created in IB have been instantiated, and all the outlets and connections are set up properly.
According to the docs , it seems that I should be able to access the content of the array in windowControllerDidLoad nib, provided I specified "Automatically Prepare Content" for the array controller. This seems not to be the case here.

Sorry, a quick look on the web does not indicate to me where in the documentation it says that you should be able to access the content of the array in windowControllerDidLoadNib. Can you give us the reference for that?
Thanks,

Ian




On 5-Aug-05, at 1:08 PM, Charilaos Skiadas wrote:


On Aug 5, 2005, at 12:50 PM, Ian McGregor wrote:



When an NSPersistentDocument subclass is loaded, and I attempt to a access the arrangedObjects in a bound NSArrayController, the array controller does not appear to contain any data yet. I am attempting access at the windowControllerDidLoadNib stage.





Which method /delegate/stage should I use to be sure the NSArrayController is ready to give me access to the stored data (arrangedObjects)? I'd like to perform actions on the array controller's arrangedObjects each time a document is loaded.



Can you be more specific what actions you want to perform on the arrangedObjects? Keep in mind that data is loaded only as needed, so I'm not even sure that arrangedObjects will contain what you expect it to. In sort, if you explain what you are trying to do, maybe we can offer another, simpler, way out.


Maybe you can intercept these objects at another stage?
Also, what makes you think that when the window controller has loaded the nib, the document has already been loaded as well?


Haris







Haris


_______________________________________________ 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
References: 
 >NSPersistentDocument arrayController Data (From: Ian McGregor <email@hidden>)
 >Re: NSPersistentDocument arrayController Data (From: Charilaos Skiadas <email@hidden>)
 >Re: NSPersistentDocument arrayController Data (From: Ian McGregor <email@hidden>)

  • Prev by Date: Re: [NEWBIE] Core Data - custom accessor does not work
  • Next by Date: Re: [NEWBIE] Core Data - custom accessor does not work
  • Previous by thread: Re: NSPersistentDocument arrayController Data
  • Next by thread: Intelligent date squishing
  • Index(es):
    • Date
    • Thread