iOS OC 创建单例

+ (MyManager *)sharedManager  
{  
        static MyManager *sharedMyManagerInstance = nil;  
        static dispatch_once_t predicate;  
        dispatch_once(&predicate, ^{  
                sharedMyManagerInstance = [[self alloc] init];   
        });  
    return sharedMyManagerInstance;  
}  

你可能感兴趣的:(iOS OC 创建单例)