这几天看GCD,居然可以实现单例:
- (id) sharedInstance
{
static MySingleton *SharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
SharedInstance = [MySingleton new];
});
return SharedInstance;
}