单例的实现方式之GCD方法
程序员文章站
2023-01-24 22:48:13
+ (singletonobject *)shareinstance;
+ (singletonobject *)shareinstance {
&...
+ (singletonobject *)shareinstance;
+ (singletonobject *)shareinstance {
static singletonobject *__singletion;
static dispatch_once_t oncetoken;
dispatch_once(&oncetoken, ^{
__singletion=[[self alloc] init];
});
return __singletion;
}
下一篇: ASP动态级联菜单实现代码