Re: Accessing shared (global) data object from nib
Re: Accessing shared (global) data object from nib
- Subject: Re: Accessing shared (global) data object from nib
- From: Andrew White <email@hidden>
- Date: Wed, 17 Nov 2004 13:15:30 +1100
Joakim Danielson wrote:
Why don't you make CommonData a singleton, as such it can be called
from anywhere in your application, i.e [[CommonData sharedInstance]
someMethod].
How do I instantiate a singleton? This is what I was getting at with the
'Add a method to the CommonData class to allow a single instance to be
globally obtained' suggestion, but I don't know how to instantiate or store
the singleton instance.
I tried the "The Objective-C language" documentation and can't find it.
Another solution is to set a delegate for NSApplication and let that
delegate contain a CommonData object.
And then I can access it via [(<cast>) [NSApp delegate] getCommonData] ? I
think that works as well as any, thanks.
--
Andrew White
_______________________________________________
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