?- (void)setupGroup1
{
// 1.创建组
LKCommonGroup *group = [LKCommonGroup group];
[self.groups addObject:group];
// 2.设置组的所有行数据
LKCommonArrowItem *clearCache = [LKCommonArrowItem itemWithTitle:@"清除图片缓存"];
// 设置缓存的大小
// NSString *caches = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
// [caches stringByAppendingPathComponent:@"com.hackemist.SDWebImageCache.default"];
NSString *imageCachePath = [SDImageCache sharedImageCache].diskCachePath;
long long fileSize
= [imageCachePath fileSize];
clearCache.subtitle = [NSString stringWithFormat:@"(%.1fM)",
fileSize / (1000.0 * 1000.0)];
__weak typeof(clearCache)
weakClearCache = clearCache;
__weak typeof(self)
weakVc = self;
clearCache.operation = ^{
[MBProgressHUD showMessage:@"正在清除缓存...."];
// 清除缓存
NSFileManager *mgr = [NSFileManager defaultManager];
[mgr removeItemAtPath:imageCachePath error:nil];
// 设置subtitle
weakClearCache.subtitle = nil;
// 刷新表格
[weakVc.tableView reloadData];
[MBProgressHUD hideHUD];
};
group.items = @[clearCache];
// LKLog(@"%lld", [@"/Users/apple/Desktop/音乐" fileSize]);
}