Apple Enterprise - NeXTanswers Support Archive
Enterprise
[Index]
[Download]


Search NeXTanswers for:

Retain Counts Of Objects Loaded From .nib Files



Creation Date: June 2, 1998
Keywords:
nib, retain, release, AppKit

Q: What are the retain counts of objects loaded from nib files? How do I make sure all of my interface objects are released when I'm finished with them?

A: All objects in a .nib file are created with internally consistent retain counts; that is, a view is retained by its superview or window and retains its subviews. The only exception to this is that objects in the top level of the nib are created with a retain count of 1. The "File's Owner" is expected to release each of these objects when they are no longer needed, and you should create outlets to these objects for this purpose. The top level of the nib consists of those objects that show up in Interface Builder's Instance view, excepting meta-objects like File's Owner and First Responder. The "release when closed" option in a window's inspector allows you to release windows for which you have no outlets. Do not use this option if you have an outlet to the window; release it manually instead. Remember that you are still responsible for releasing any objects that you retain in your custom objects' init: or awakeFromNib: methods.


OpenStep | Alliances | Training | Tech Support | Where to Buy