Re: Making multiple windows from the same class
Re: Making multiple windows from the same class
- Subject: Re: Making multiple windows from the same class
- From: Brendan Younger <email@hidden>
- Date: Wed, 1 Aug 2001 13:17:28 -0500
On Wednesday, August 1, 2001, at 06:42 AM, Rosyna wrote:
>
I have the following code for making a preference window (and it only
>
allows it to be opened once, as it should):
>
>
- (pref *)preferencesController
>
{
>
if (!preferencesController) {
>
preferencesController = [[pref alloc] init];
>
}
>
return preferencesController;
>
}
>
>
am I right to assume changing it to:
>
>
- (pref *)preferencesController
>
{
>
>
preferencesController = [[pref alloc] init];
>
>
return preferencesController;
>
}
>
>
will allow multiple windows?
>
>
If this does, how do I release of the controllers once the window is
>
closed? I am thinking this would be done in windowWillClose.
>
-- Sincerely,
>
Rosyna Keller
>
Technical Support/Holy Knight/Always needs a hug
>
>
Unsanity: Unsane Tools for Insane People
>
You shouldn't have to worry about cleaning it up afterwards, you should
return an autoreleased object. For example:
- (pref *)preferencesController
{
preferencesController = [[pref alloc] init];
return [preferencesController autorelease];
}
Whatever object requests it must keep it around by retaining it.
Brendan Younger