• 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: Ian McGregor <email@hidden>
  • Date: Fri, 5 Aug 2005 12:35:03 -0700

Hi Matthew, thanks for pointing me in the right direction.

However, I notice that I already have "Already prepares content" selected for my array controller. Also, calling [myArrayController prepareContent] in windowControllerLoadsNib, does not seem to bring up the content either.

The content definitely exists in the stored file (SQL) and loads just fine into the UI when the document is opened.


On 5-Aug-05, at 12:21 PM, Matthew Firlik wrote:


On Aug 5, 2005, at 10:50 AM, 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.

In the NSPersistentDocument subclass:

- (void)windowControllerDidLoadNib:(NSWindowController *) windowController
{
[super windowControllerDidLoadNib:windowController];
unsigned int count = [[myArrayController arrangedObjects] count]; // 0
}


- (void)someMethod
{
unsigned int count = [[myArrayController arrangedObjects] count]; // value i.e. 243
}


Cheers,

Ian

Ian:

The controller must be configured to automatically fetch the content: by default, it does not. You'll want to look at:

http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/CntrlContent.html#//apple_ref/doc/uid/ TP40002147-183071

(The section on "automatically prepares content" is what you need.)

- matthew


_______________________________________________ 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>)

  • Prev by Date: Re: objc and RDBMS
  • Next by Date: How do I "globally" do a #define using X_Code ver 1.5
  • Previous by thread: NSPersistentDocument arrayController Data
  • Next by thread: Re: NSPersistentDocument arrayController Data
  • Index(es):
    • Date
    • Thread