UITableViewCell圆角图片优化心得 发表于 2018-04-26 Cell上面的圆角,避免每次复用时重复处理图片 没有废话,直接上代码: 工具:YYImage 12345678910111213141516+ (YYWebImageManager *)avatarImageManager {static YYWebImageManager *manager;static dispatch_once_t onceToken;dispatch_once(&onceToken, ^{NSString *path = [[UIApplication sharedApplication].cachesPath stringByAppendingPathComponent:@"USG.Avatar"];YYImageCache *cache = [[YYImageCache alloc] initWithPath:path];manager = [[YYWebImageManager alloc] initWithCache:cache queue:[YYWebImageManager sharedManager].queue];manager.sharedTransformBlock = ^(UIImage *image, NSURL *url) {if (!image) return image;return [image imageByRoundCornerRadius:100]; // a large value};});return manager;} 12345678[self setImageWithURL:urlplaceholder:placeholderoptions:kNilOptionsmanager:[USGHelper avatarImageManager]progress:niltransform:nilcompletion:nil];