Tag: copywithzone

实施copyWithZone时的最佳做法:

我正在尝试清理一些关于执行copyWithZone:事情copyWithZone: ,任何人都可以对以下内容进行评论… // 001: Crime is a subclass of NSObject. – (id)copyWithZone:(NSZone *)zone { Crime *newCrime = [[[self class] allocWithZone:zone] init]; if(newCrime) { [newCrime setMonth:[self month]]; [newCrime setCategory:[self category]]; [newCrime setCoordinate:[self coordinate]]; [newCrime setLocationName:[self locationName]]; [newCrime setTitle:[self title]]; [newCrime setSubtitle:[self subtitle]]; } return newCrime; } // 002: Crime is not a subclass of NSObject. – […]