zoukankan      html  css  js  c++  java
  • 调用系统的相册

    第一步遵守协议,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];
    }

     
  • 相关阅读:
    jenkins持续集成
    对pm2对研究
    模板⽅法模式
    python configparser模块
    Python正则表达式
    Python读写文件之换行符
    Python字符串
    Python字典
    Python列表
    爬虫 urllib,requests,lxml,bs4 小结
  • 原文地址:https://www.cnblogs.com/huoxingdeguoguo/p/4611492.html
Copyright © 2011-2022 走看看