Re: IBOutlet and Shared Instances
Re: IBOutlet and Shared Instances
- Subject: Re: IBOutlet and Shared Instances
- From: Shawn Erickson <email@hidden>
- Date: Tue, 6 Dec 2005 13:01:50 -0800
On 12/6/05, Juan Alvarez <email@hidden> wrote:
>
Hi,
>
I've been trying to access an IBOutlet from a shared instance I have
>
created but it doesnt work. Can someone tell what I need to do here:
>
>
+ (id)sharedInstance
>
{
>
static MyClass *_myclass = nil;
>
>
if (! _myclass) {
>
_myclass = [[MyClass allocWithZone:[self zone]] init];
>
}
>
return _myclass;
>
}
>
>
Is it possible to get access to the shared instance's IBOutlet?
>
Basically I want access to the NSArrayController that MyClass is
>
connected to. Thanks!
You got me a little confused... :)
It sounds like an instance of MyClass exists in a nib and that
instance has a connection (via an outlet) to an instance of
NSArrayController also in that nib. If that is true then your code
above is creating a new instance of MyClass, one different then the
one defined in the nib and one that will not have its outlet connected
by the nib loading mechanism.
I am inferring use of a nib (Interface Builder) here from the fact
that you are talking about using an IBOutlet.
-Shawn
_______________________________________________
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