单例

+ (instancetype)shareInstance {
    static dispatch_once_t onceToken;
    static SingleTon *singleTon = nil;
    dispatch_once(&onceToken, ^{
        singleTon = [[SingleTon alloc]init];
    });
    return delegate;
}
+(id) allocWithZone:(struct _NSZone *)zone  
{  
    return [Singleton shareInstance] ;  
}  
  
-(id) copyWithZone:(struct _NSZone *)zone  
{  
    return [Singleton shareInstance] ;  
} 

你可能感兴趣的:(单例)