Re: Programmatically adding objects to an ArrayController
Re: Programmatically adding objects to an ArrayController
- Subject: Re: Programmatically adding objects to an ArrayController
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 16 May 2006 09:56:38 -0700
On May 16, 2006, at 3:26 AM, Mike Abdullah wrote:
On 16 May 2006, at 10:01AM, Jesus De Meyer wrote:
I'm using an ArrayController to feed data to an NSTableView.
However, in my awakeFromNib method, I would like to add some
standard data to this ArrayController. The ArrayController is
bound to a method that returns an NSMutableArray for its
contentArray field.
So to add an object to this array, do I have to do something like
this? Or is there a better way?
What did you try? What were the results? What did the documentation
say?
[myArrayController addObject:theObject];
[myArray addObject:theObject];
Either should do the job just fine.
No, given the scenario outlined above, the latter will probably not
work correctly (see the relevant documentation).
Why not make it set the inital array in its init method?
If this is a document-based application, NSDocument provides a
specific method to allow data initialisation:
<http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSDocument_index.html>
mmalc
_______________________________________________
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