Re: NSArrayController and bindings
Re: NSArrayController and bindings
- Subject: Re: NSArrayController and bindings
- From: Bjoern Kriews <email@hidden>
- Date: Wed, 25 Feb 2004 00:32:43 +0100
On 24.02.2004, at 23:47, mmalcolm crawford wrote:
On Feb 24, 2004, at 1:51 PM, Bjoern Kriews wrote:
Don't subclass Cocoa objects if you don't have to - it easier to use
another object:
Subclass NSObject
Umm, NSObject is a "Cocoa object"...
Yes. I just wanted to keep the poster from unneccesarily subclassing
NSArrayController :-)
into SomeController, add an outlet "arrayController" and an action
"save:", instantiate it in your nib
and connect the outlet to your ArrayController, create the source
files for SomeController and
add
[[arrayController content] writeToFile:@"/tmp/some.plist"
atomically:YES];
to the save: method.
(content returns the array the controller is managing
It is possibly more likely that SomeController has an array instance
variable to which the array controller's content is bound.
SomeController is likely also to manage other objects. Any 'save:'
method would probably therefore either simply archive SomeController's
array variable directly (as opposed to asking the arrayController for
its content), or create an archive of all the relevant data and model
objects.
I agree - my intention was to answer his question in a very direct way.
And I think there are cases where it is convenient to just let the
Controller
manage the array - i.e. simple preferences.
(more on that in a fresh thread "Array Bindings and
NSUserDefaultsController")
Regards, Bjoern
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.