mutablecopy 实现了,但是还是浅拷贝,我想弄深拷贝,现在只能怀疑是里面协议实现的不对了
引用拷贝协议 自己实现mutablecopy方法后 就是深拷贝了
- (instancetype)mutableCopyWithZone:(NSZone *)zone {
AModel *model = [[AModel allocWithZone:zone] init];
return model;
}
这样是只对 AModel 本身进行复制
- (instancetype)mutableCopyWithZone:(NSZone *)zone {
AModel *model = [[AModel allocWithZone:zone] init];
model.aStr = [self.aStr mutableCopy];
return model;
}
这样会连带Mode的属性一起被复制