iOS???????????????
???????????? ???????[ 2015/3/6 15:11:40 ] ????????iOS ???????? ???????
??????????????????????????????????????洦????????????????????????к????е???????????SDWebImage??
????????????????????????洢???????????????????????????????????????app????書???
???????????????湦??????????????????????С??????????????????????
?????????????????С
??????????????????????У???????????NSFileManager API??????????????С?????
???????????????С
????+(float)fileSizeAtPath:(NSString*)path{
????NSFileManager*fileManager=[NSFileManager defaultManager];
????if([fileManager fileExistsAtPath:path]){
????long long size=[fileManager attributesOfItemAtPath:path error:nil].fileSize;
????return size/1024.0/1024.0;
????}
????return 0;
????}
????????????С
????+(float)folderSizeAtPath:(NSString*)path{
????NSFileManager*fileManager=[NSFileManager defaultManager];
????float folderSize;
????if([fileManager fileExistsAtPath:path]){
????NSArray*childerFiles=[fileManager subpathsAtPath:path];
????for(NSString*fileName in childerFiles){
????NSString*absolutePath=[path stringByAppendingPathComponent:fileName];
????folderSize+=[FileService fileSizeAtPath:absolutePath];
????}
????//SDWebImage????????????????
????folderSize+=[[SDImageCache sharedImageCache]getSize]/1024.0/1024.0;
????return folderSize;
????}
????return 0;
????}
??????????????
??????????????NSFileManager API?????????????SDWebImage???????????????????????????????????á?
????+(void)clearCache:(NSString*)path{
????NSFileManager*fileManager=[NSFileManager defaultManager];
????if([fileManager fileExistsAtPath:path]){
????NSArray*childerFiles=[fileManager subpathsAtPath:path];
????for(NSString*fileName in childerFiles){
????//???????????????????????????????????
????NSString*absolutePath=[path stringByAppendingPathComponent:fileName];
????[fileManager removeItemAtPath:absolutePath error:nil];
????}
????}
????[[SDImageCache sharedImageCache]cleanDisk];
????}
???????Ч????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11