计算从ios照片库中选取的图片文件大小
本文轉(zhuǎn)載至:http://blog.csdn.net/longzs/article/details/8373586
?
?
從 iphone 的 照片庫(kù)中選取的圖片,由于 系統(tǒng)不能返回其文件的具體路徑,所以這時(shí)要用到 ALAssetsLibrary
?
代碼如下:
???? ALAssetsLibrary* alLibrary = [[ALAssetsLibrary alloc] init];
??? __block float fileMB? = 0.0;
????
??? [alLibrary assetForURL:[info objectForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset)
???? {
???????? ALAssetRepresentation *representation = [asset defaultRepresentation];
???????? fileMB = (float)([representation size]/perMBBytes);
???????? NSLog(@"size of asset in bytes: %0.2f", fileMB);
???????? iHasAsset = 1;
???????? [alLibrary release];
???? }
????????????? failureBlock:^(NSError *error)
???? {
???????? iHasAsset = 2;
???????? [alLibrary release];
???? }];
轉(zhuǎn)載于:https://www.cnblogs.com/Camier-myNiuer/p/3301191.html
總結(jié)
以上是生活随笔為你收集整理的计算从ios照片库中选取的图片文件大小的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 那些花儿【II】
- 下一篇: UFLDL 教程学习笔记(三)自编码与稀