选择系统相册图片之后显示其文件名字
//选择图片的时候调用
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *img = [info objectForKey:UIImagePickerControllerEditedImage];
if (img != nil)
{
//获取图片的名字
__block NSString *imageFileName;
NSURL *imageURL = [info valueForKey:UIImagePickerControllerReferenceURL];
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
ALAssetRepresentation *representation = [myasset defaultRepresentation];
imageFileName = [representation filename];
NSLog(@"imageFileName : %@",imageFileName);
//文件名字
v_cert.lbl_file.text = imageFileName;
};
ALAssetsLibrary *assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:imageURL
resultBlock:resultblock
failureBlock:nil];
}
//设置上传的图片
v_cert.img_file.image = img;
[picker dismissViewControllerAnimated:YES completion:nil];
}