单例
来源:互联网 发布:镇南关大捷知乎 编辑:程序博客网 时间:2024/04/30 08:19
static ImageCache *sharedCacheInstance =nil;
+ (ImageCache *)sharedCache
{
@synchronized(self) {
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
sharedCacheInstance = [[selfalloc]init];
});
}
returnsharedCacheInstance;
}