OC中
static Tools *_instance;
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[super allocWithZone:zone]init];
});
return _instance;
}
+ (instancetype)shareInstance {
return [[Tools alloc]init];
}
网友评论