[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about memory management
From: |
Ivan Vučica |
Subject: |
Re: Question about memory management |
Date: |
Fri, 7 Jun 2013 13:47:03 +0200 |
On 7. 6. 2013., at 10:47, David Chisnall <address@hidden> wrote:
> On 7 Jun 2013, at 09:42, Maxthon Chan <address@hidden> wrote:
>
>> Well can I (just like NSApplication):
>>
>> 1) In supercalss, define the shared instance as id
>> 2) In superclass, return the shared instance as id or instancetype
>> 3) In superclass, DO NOT set up yet.
>> 4) In superclass, set up in the method asking for the shared instance, which
>> always use [[self alloc] init]?
>
> NSApplication is an example of a singleton designed for subclassing. It
> provides an explicit mechanism for defining the subclass that should be used
> for the singleton instance: a string in the Info.plist providing the name of
> the application class to use. It also sets up its delegate in this way and
> gets the name of the nib to load on application start.
>
> David
>
> -- Sent from my brain
>
Also notable is NSDocumentController, which is explicitly being overridden by
[MyDocumentController sharedController] before first use by either the app or
the framework; that is, in -applicationWillFinishLaunching:.
I do this to prevent the user from opening more than one document while still
leveraging other parts of the document architecture.
Regards,
Ivan Vučica
via phone
- Re: Question about memory management, (continued)
- Re: Question about memory management, Graham Lee, 2013/06/05
- Re: Question about memory management, Germán Arias, 2013/06/05
- Re: Question about memory management, Ivan Vučica, 2013/06/06
- Re: Question about memory management, Maxthon Chan, 2013/06/07
- Re: Question about memory management, David Chisnall, 2013/06/07
- Re: Question about memory management, Graham Lee, 2013/06/07
- Re: Question about memory management, David Chisnall, 2013/06/07
- Re: Question about memory management, Maxthon Chan, 2013/06/07
- Re: Question about memory management, David Chisnall, 2013/06/07
- Re: Question about memory management, Maxthon Chan, 2013/06/07
- Re: Question about memory management,
Ivan Vučica <=
- Re: Question about memory management, Maxthon Chan, 2013/06/07
- Re: Question about memory management, David Chisnall, 2013/06/07