2016.8.17
两个对象指向同一个内存地址,修改一个对象,另一个也会被修改,所以要复写一下copy方法
// self.relationData = [relation copy];
@implementation RelationData
//- (id)copy {
// RelationData *p = [RelationData shareInstance];
// p.name = [self.name copy];
// p.idCardNo = [self.idCardNo copy];
// p.gender = (int)[[NSNumber numberWithInt:self.gender] copy];int类型先转成number类型的再copy
// p.phone = [self.phone copy];
// p.place = [self.place copy];
// p.addr = [self.addr copy];
// p.email = [self.email copy];
// p.qq = [self.qq copy];
// p.dailyFee = [self.dailyFee copy];
// p.otherIncome = [self.otherIncome copy];
// p.contacts = [self.contacts copy];
// p.idCards = [self.idCards copy];
// return p;
//}
@end
网友评论