@iwanglong
2019-02-21T07:01:43.000000Z
字数 598
阅读 237
iOS
@implementation Single+ (id)sharedInstance{static Single *instance = nil;static dispatch_once_t onceToken;dispatch_once(&onceToken, ^{instance = [[super allocWithZone:NULL] init];});return instance;}+ (instancetype)allocWithZone:(struct _NSZone *)zone{return [self sharedInstance];}- (id)copyWithZone:(nullable NSZone*)zone{return self;}@end