If I tie some interface builder objects to another object as instance variables, do they need to be released in dealloc method of the parent object? The important point is that I declare my IBOutlets with key-value coding(@property) in (nonatomic, retain) mode. In my theory IBOutlet objects is created when initWithNibName:... method of my view controller is called and it is retained by the parent object because I implemented an @property method in retain mode. Is this correct? What about if I implement the method in assign mode?
+2
A:
Absolutely correct. You have to release the (retain) properties in dealloc, IBOutlet or not. This way memory management for IBOutlets is clearly defined.
If you wire up IBOutlets from objects that are already retained (e.g. subviews of otherwise retained views), you can also use (assign) for your properties (and, of course, not release them in dealloc).
Nikolai Ruhe
2009-07-06 10:43:57