码迷,mamicode.com
首页 > 其他好文 > 详细

UIImagePickerController获取图片名

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

标签:style   color   get   cti   name   for   

//创建

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获取图片名

标签:style   color   get   cti   name   for   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!