Hi,
What you are doing is probably bad design. I would recommend your read up on the MVC (Model View Controller) pattern: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html

In your set up, the ApplicationDelegate is your controller, the NSMutableArray's are your models, and your NSView's are obviously your views.

What you probably want to do is add accessor methods or properties to your NSView for these NSMutableArrays. For an example of these accessors, see http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/SubclassingNSView/chapter_6_section_5.html#/ /apple_ref/doc/uid/TP40002978-CH7-SW34

Then, in your ApplicationDelegate, you would just call [myView setFoo:myMutableArray]. That way, ApplicationDelegate is fully fulfilling its role as a controller: connecting your models (myMutableArray) to your view (myView).


Adam Leonard


On May 18, 2008, at 10:03 PM, Joey None wrote:

Hello all,

I hope someone can help me with this.

I have my ApplicationDelegate which contains a couple of NSMutableArrays with data in them.

Then I have a few CustomNSViews classes which I have sub-classed.

I need to access the NSMutableArrays declared on the AppDelegate class from the NSView sub-classes I have created.

Any ideas on how to do this? I know there has to be a way and have spent all night looking for it but so far no luck.

Thank you very much for all your help!
JC



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/adam%40caffeinatedcocoa.com

This email sent to [EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to