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: Mason Mark <email@hidden>
- Date: Thu, 30 Aug 2001 13:21:33 -0700
For a window that will persist until it is closed, alloc and init as you
do.
Then don't release the window controller when the window closes, but
autorelease it when you are done with it.
e.g.:
//assuming window controller is window delegate
- (void)windowWillClose:(NSNotification *)notification {
//do whatever you need to do to clean up when the window closes
[self autorelease];
}
--
Mason
--On Thursday, August 2, 2001 4:36 PM -0700 Rosyna <email@hidden>
wrote:
If I do [self release] it always crashes. I can't make it auto
release, then it disappears before I want it to and it crashes at
that too. Should I not be telling self to release?
Its for a different window, I just had the preferences code done already.
- (id)init {
self = [super init];
if (![NSBundle loadNibNamed:@"myNib" owner:self]) {
NSLog(@"Failed to load myNib");
NSBeep();
return self;
}
return self;
}
I wasn't quite sure how to implement joar's recommendation.
Ack, at 8/1/01, Adrian Ridner said:
That looks right! You should release it inside windowWillClose or
windowDidClose. I'm curious as how you are loading your Preference
nib file and display in it? and why would you want to have multiple
instances of the Preferences window instead of a shared one? But
the code looks correct.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insane People
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev