• 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: windowcontroller neccessary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: windowcontroller neccessary?


  • Subject: Re: windowcontroller neccessary?
  • From: Mike Ferris <email@hidden>
  • Date: Tue, 14 Jan 2003 08:11:05 -0800

The main nib sticks around the whole time the program is running (although you can manually release objects that were loaded from it).

NSWindowController is good for managing other nibs (not the main nib). And the leaking part comes in when the nib contains stuff you may load multiple times and get rid of during the course of the app, such as document windows. The way that NSDocument makes sure to clean up stuff when it closes is by using NSWindowController (either implicitly behind your back, or explicitly via your code).

Mike


Begin forwarded message:

From: daniel oberhoff <email@hidden>
Date: Mon Jan 13, 2003 11:45:21 AM US/Pacific
To: cocoa-dev <email@hidden>
Subject: Fwd: windowcontroller neccessary?

ok, thanks! i think things are clearer now. but what do you mean with leaking? wont the principal NSApplication deallocate recources used by the main nib-file (or similarly wont the NSDocument subclass deallocate the documents nib-files resources)?

daniel

Anfang der weitergeleiteten E-Mail:

Von: Mike Ferris <email@hidden>
Datum: Sam, 11. Jan 2003 19:53:07 Europe/Zurich
An: daniel oberhoff <email@hidden>
Cc: cocoa-dev <email@hidden>
Betreff: Re: windowcontroller neccessary?

An NSWindowController gives you some nice nib-management features. For example, an NSWindowController knows about all the top-level objects in the nib it loads and it will release them when it goes away. Without this you have to be sure to create outlets to all the top-level objects and release them yourself or you'll leak.

The NSWindowController for a window does not have to be the window's delegate. A window can have both a windowController and a delegate. It is often the case that people make their windowControllers be the window's delegate as well, however.

You do not have to have an NSWindowController, and if you do have one it can be a subclass or just a plain NSWindowController (although usually it is a subclass).

If you are using NSDocument then the document windows will always have a windowController. For non-document windows, you can do what you like, but NSWindowController is a really good class to start with for your File's Owner.

Mike
_______________________________________________
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.

  • Prev by Date: Re: Using WebCore.framework
  • Next by Date: Using Inkwell
  • Previous by thread: Fwd: windowcontroller neccessary?
  • Next by thread: Re: Fwd: windowcontroller neccessary?
  • Index(es):
    • Date
    • Thread