• 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: How to completely release every object allocated when opening a NIB file ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to completely release every object allocated when opening a NIB file ?


  • Subject: Re: How to completely release every object allocated when opening a NIB file ?
  • From: amy <email@hidden>
  • Date: Fri, 16 Jan 2004 02:01:16 -0800

How is keeping your own array of window controllers different/better than adding window controllers to your document? What I've done in my main window controller class is:

- (void) displayAnotherWindow: (id) sender {

AnotherWindowController = *awc = [[AnotherWindowController alloc] init];
[[self document] addWindowController: awc];
[awc showWindow: sender];
[awc release];

}

In AnotherWindowController's init method, I put the following for the window nib name, which is I believe similar to what Charles uses:

self = [super initWithWindowNibName: @"AnotherWindow"];

The above style is working pretty well for me, but I'm wondering if I should try the style mmalcolm described below to solve a problem with my app. I've got a problem with menu items in the main menu at the top of the screen being dimmed and unavailable when the "another window" is in front. In particular, the menu item that will bring up "another window" is dim, and I would be like to be able to bring up any number of these windows conveniently (usually via keyboard shortcut for the menu item) without having to make the main document window active each time I want another window displayed.


On Jan 14, 2004, at 1:22 AM, Charles Srstka wrote:

On Jan 14, 2004, at 2:27 AM, mmalcolm crawford wrote:

- (IBAction)makeNewWindow:(id)sender
{
MyWindowController *wc = [[MyWindowController alloc] init];
[windowsArray addObject:wc];
[wc release];
[wc showWindow:nil];

[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(wcWindowClosed:)
name:NSWindowWillCloseNotification
object:[wc window]];

}

- (void)wcWindowClosed:(NSNotification *)note
{
MyWindowController *wc = [[note object] delegate];
[windowsArray removeObject:wc];
}


(You'd override windowNibName in MyWindowController

- (NSString *)windowNibName
{
return @"MyWindow";
}

)

I don't get it. Why not just call -[NSWindowController initWithWindowNibName:] instead of subclassing it to override windowNibName?

Charles
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: How to completely release every object allocated when opening a NIB file ?
      • From: mmalcolm crawford <email@hidden>
References: 
 >How to completely release every object allocated when opening a NIB file ? (From: Jérome Foucher <email@hidden>)
 >Re: How to completely release every object allocated when opening a NIB file ? (From: mmalcolm crawford <email@hidden>)
 >Re: How to completely release every object allocated when opening a NIB file ? (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: NSTextView data binding delay
  • Next by Date: Objective-C and C
  • Previous by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Index(es):
    • Date
    • Thread