ios对象copy的方法,要实现nscopy协议
by 伍雪颖
- (id)copyWithZone:(NSZone *)zone { RestEntity *copy = [[[self class] allocWithZone:zone] init]; copy.dishId = _dishId; return copy; } - (id)mutableCopyWithZone:(NSZone *)zone { RestEntity *copy = [RestEntity allocWithZone:zone]; copy.dishId = _dishId; return copy; }
NSObject <NSCopying,NSMutableCopying>
时间: 2024-10-29 00:42:12