So say in my viewcontroller’s .h file I have:
@interface MyViewController : UIViewController {
IBOutlet UILabel *myLabel;
IBOutlet UIView *myView;
IBOutlet UIImageView *myImageView;
IBOutlet UIButton *myButton;
NSNumber *myNumber;
NSString *myString;
NSMutableArray *myArray;
UILabel *myCurrentLabel;
SomeObject *myObject;
CGPoint myPoint;
}
… now in the viewcontroller’s .c file
- (void)dealloc {
[myLabel release];
[myView release];
[myImageView release];
[myButton release];
[myNumber release]; // is this necessary?
[myString release]; // is this necessary?
[myArray release];
[myCurrentLabel release];
[myObject release];
// I don't need to release myPoint because it's a struct
[super dealloc];
}
Please see my comments in the .c file, I’m just wondering if my release statements are correct (and if not, why)…
Thank you!!
Without seeing your init code, it is impossible to tell. As a general rule, you need to release anything that you init that is not autoreleased. For example:
In the above 3, you would only have to release array2 if you do not replace them with any other code later on.