请帮助我,这个代码是否正确?我的意思是,我们真的需要在这个类中使用 dealloc 方法吗,为什么需要或不需要呢?如果我们在这里不使用 dealloc 会不会是内存泄漏?谢谢!
#import <Foundation/Foundation.h>
@interface MyData : NSObject
{
@private
NSString *name;
NSString *surname;
NSString *email;
NSString *telephone;
UIImage *image;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *surname;
@property (nonatomic, retain) NSString *email;
@property (nonatomic, retain) NSString *telephone;
@property (nonatomic, retain) UIImage *image;
@end
#import "MyData.h"
@implementation MyData
@synthesize name;
@synthesize surname;
@synthesize email;
@synthesize telephone;
@synthesize image;
- (void) dealloc
{
[name release];
[surname release];
[email release];
[telephone release];
[image release];
[super dealloc];
}
@end