ELCImagePickerController 同时选择多张图片时,获取文件名称
来源:互联网 发布:手机排课软件 编辑:程序博客网 时间:2024/05/11 16:02
for (NSDictionary *dictin info) {
if ([dictobjectForKey:UIImagePickerControllerMediaType] ==ALAssetTypePhoto){
if ([dictobjectForKey:UIImagePickerControllerOriginalImage]){
UIImage* image=[dictobjectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];
//获取图片名称
__blockNSString *imageName = [NSStringnew];
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset){
ALAssetRepresentation *representation = [myassetdefaultRepresentation];
imageName = [representation filename];
NSLog(@"fileName : %@",imageName);
};
//注意这个地方,网上大多数用的是系统的类,单张选中,所以这个地方会是info,所以如果直接网上复制的代码,运行之后,会报错,需要改成dict
NSURL *imageURL = [dictvalueForKey:UIImagePickerControllerReferenceURL];
ALAssetsLibrary* assetslibrary = [[ALAssetsLibraryalloc]init];
[assetslibrary assetForURL:imageURL
resultBlock:resultblock
failureBlock:nil];
[selfdismissViewControllerAnimated:YEScompletion:^{
//获取图片的类型前的名字,将字符串切割操作
NSString *imagePath = [[imageNamecomponentsSeparatedByString:@"."]
firstObject];
NSString *aPath=[NSStringstringWithFormat:@"%@/Documents/%@.jpg",
NSHomeDirectory(),imagePath];
NSData *imgData =UIImageJPEGRepresentation(image,0);
//将图片写入沙盒
[imgData writeToFile:aPathatomically:YES];
NSLog(@"path == %@ ==%@",imagePath,aPath);
}];
} else {
NSLog(@"UIImagePickerControllerReferenceURL = %@", dict);
}
} elseif ([dictobjectForKey:UIImagePickerControllerMediaType] ==ALAssetTypeVideo){
}
- ELCImagePickerController 同时选择多张图片时,获取文件名称
- ELCImagePickerController 选择图片
- 多张图片选择
- php同时上传多张图片
- AFNetWorking同时上传多张图片方式
- 异步下载图片,同时下载多张图片
- 仿QQ发表动态,获取系统相册,选择多张图片上传
- 从系统相册选择多张图片
- 从系统相册选择多张图片
- 从系统相册选择多张图片
- 从系统相册选择多张图片
- 从系统相册选择多张图片
- ionic选择多张图片上传
- 从相册中选择多张图片
- Android多张图片选择框架
- iOS 自定义多张图片选择+demo
- 同时上传N张图片
- 使用ASIHTTPRequest同时向服务器发送多张图片
- 面试中的排序算法总结
- Tomcat一步步实现反向代理、负载均衡、内存复制
- ubuntu 安装mysql5.6
- redis-windows环境安装与测试+linux环境安装与测试
- JFram制作简单音乐播放器
- ELCImagePickerController 同时选择多张图片时,获取文件名称
- Java 通过JDBC连接orcal数据库的方法和实例
- http://lib.csdn.net/swift/node/5?page=19#md
- ios UITextView placeHolder效果
- 数据结构--图
- 软件概要设计与详细设计的区别
- LauncherModel.Callbacks接口
- 什么是回调函数
- 怎么用ABBYY FineReader的快速任务功能