首页 > 其他 > 详细

调用系统的相册

时间:2015-06-30 21:52:20      阅读:249      评论:0      收藏:0      [点我收藏+]

第一步遵守协议,UIImagePickerControllerDelegate,UINavigationControllerDelegate

第二步:创建picker对象

    UIImagePickerController * picker = [[UIImagePickerController alloc]init];
第三步 :打开的模式三种

    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    UIImagePickerControllerSourceTypePhotoLibrary,
    UIImagePickerControllerSourceTypeCamera,
    UIImagePickerControllerSourceTypeSavedPhotosAlbum

第四步:设置代理

    picker.delegate = self;
第五步:进入相册

    [self presentViewController:picker animated:YES completion:nil];
选中相册中某一种照片的协议方法为

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
        //获取选中的图片
    UIImage * selectImage = [info objectForKey:UIImagePickerControllerOriginalImage];
    self.imageView.image = selectImage;
    //将picker隐藏
    [picker dismissViewControllerAnimated:YES completion:nil];
}

 

调用系统的相册

原文:http://www.cnblogs.com/huoxingdeguoguo/p/4611492.html

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