标签:blog ar 2014 sp cti log on c amp
//基于gcd的单例模式
static Type *_instances; + (id)allocWithZone:(NSZone *)zone { static dispatch_once_t onceToken; dispatch_once(&onceToken,^{ _instances = [super allocWithZone:zone]; }); return _instances; } //创建一个获取单例的方法 + (Type *)sharedInstances { if(_instances == nil){ _instances = [[self alloc] init]; } return _instances; }
标签:blog ar 2014 sp cti log on c amp
原文地址:http://blog.csdn.net/chenchaoflight/article/details/39186859