标签:
static Person *person
//单例初始化方法
+ (instancetype)allocWithZone:(struck _NSZone*)zone{
if (person == nil){
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
person = [super allocWithZone:zone];
});
}
return person;
}
+ (instancetype)sharePerson{
return [[self alloc]init];
}
- (id)copy{
return self;
}
标签:
原文地址:http://www.cnblogs.com/xiaojiang-123/p/5263080.html