首页 > 其他 > 详细

UIImagePickerController获取图片名

时间:2014-06-28 07:49:43      阅读:428      评论:0      收藏:0      [点我收藏+]

//创建

UIImagePickerController *imagePick = [[UIImagePickerController alloc] init];

        imagePick.delegate = self;

        imagePick.allowsEditing = YES;

        imagePick.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        imagePick.mediaTypes=[NSArray arrayWithObject:@"public.image"];

[self presentViewController:imagePick animated:animated completion:completion];




只需实现代理方法

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

{

    // get the ref url

    NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

    [library assetForURL:assetURL resultBlock:^(ALAsset *asset) {

        ALAssetRepresentation *imageRep = [asset defaultRepresentation];

        NSLog(@"[imageRep filename] : %@", [imageRep url]);

        NSLog(@"[imageRep filename] : %@", [imageRep filename]);

        

    } failureBlock:^(NSError *error) {

        

    }];

}



UIImagePickerController获取图片名,布布扣,bubuko.com

UIImagePickerController获取图片名

原文:http://blog.csdn.net/dengmeiyu/article/details/35273281

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!