If you create a subclass of UIviewController, the dealloc method is automatically created for you.
- (void)dealloc{}
However, when I create the Objective-C class, the method is not automatically created. Do I need to add a dealloc method so that I can release properties in the class? Especially if I saved them in the header file?
For example, in my Objective-C class header file, I have
@interface ClassA : NSObject { NSString *someProperty; UINavigationController *navcon; } @property (nonatomic, retain) NSString *someProperty; @property (nonatomic, retain) UINavigationController *navcon;
Do I need to manually create the dealloc method to free the properties as shown below?
-(void)dealloc { [someProperty release]; [navcon release]; }
Zhen source share