当前位置:编程学习 > wap >>

单例的实现方式之易做图方法

+ (SingletonObject *)shareInstance;


+ (SingletonObject *)shareInstance {

    static SingletonObject *__singletion;

    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{

        __singletion=[[self alloc] init];

    });

    return __singletion;

}

 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,