写出set方法

@property (nonatomic, retain) NSString *name;

- (void)setName:(NSString *)name
{
    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
}

@property(nonatomic, copy) NSString *name;

- (void)setName:(NSString *)name
{
    if (_name != name) {
        [_name release];
        _name = [name copy];
    }
}

你可能感兴趣的:(写出set方法)