• 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: Accessing shared (global) data object from nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Accessing shared (global) data object from nib
      • From: Clark Cox <email@hidden>
References: 
 >Accessing shared (global) data object from nib (From: Andrew White <email@hidden>)
 >Re: Accessing shared (global) data object from nib (From: Joakim Danielson <email@hidden>)

  • Prev by Date: Re: how to make a finder-like button
  • Next by Date: Re: Accessing shared (global) data object from nib
  • Previous by thread: Re: Accessing shared (global) data object from nib
  • Next by thread: Re: Accessing shared (global) data object from nib
  • Index(es):
    • Date
    • Thread