iOS UI 21 单例中的线程

//

//  Datahandle.h

//  Ui - 21 线程

//

//  Created by dllo on 15/12/9.

//  Copyright (c) 2015 dllo. All rights reserved.

//


#import <Foundation/Foundation.h>


@interface Datahandle : NSObject

+(instancetype)datahandlesharedata;

@end

//

//  Datahandle.m

//  Ui - 21 线程

//

//  Created by dllo on 15/12/9.

//  Copyright (c) 2015 dllo. All rights reserved.

//


#import "Datahandle.h"


@implementation Datahandle

+(instancetype)datahandlesharedata

{

    static Datahandle *Data = nil;

    if (nil == Data) {

        Data = [[Datahandle alloc]init];

        

    }

    dispatch_once_t once = 0;

    dispatch_once(&once, ^{

        

        Data = [[Datahandle alloc]init];

    });

    return Data;

    

}

@end



原文地址:https://www.cnblogs.com/yuhaojishuboke/p/5043065.html