• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IBOutlet and Shared Instances
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >IBOutlet and Shared Instances (From: Juan Alvarez <email@hidden>)

  • Prev by Date: Drag & Drop Launch
  • Next by Date: Re: Are NSViews autoreleased or released?
  • Previous by thread: IBOutlet and Shared Instances
  • Next by thread: NSTableView drag and drop Border
  • Index(es):
    • Date
    • Thread