//创建单例(线程安全)
+ (id) sharedVC {
static ViewController *vc = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
vc = [[self alloc]init];
});
return vc;
}
//创建单例
+ (id) sharedVc {
static ViewController *vc = nil;
if (vc == nil) {
vc = [[ViewController alloc]init];
}
return vc;
}