zoukankan      html  css  js  c++  java
  • IOS UIImagePickerController 保存图片到 相册

     // 异步下载图片

            dispatch_queue_t queue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);

            dispatch_group_t group =dispatch_group_create();

            dispatch_group_async(group, queue, ^{

                NSData *data = [NSDatadataWithContentsOfURL:[NSURLURLWithString:imageUrl]];

                UIImage *image = [UIImageimageWithData:data];

                    //  保存图片到相册

                    [PDPhotoGraphToolsaveImageToPhotos:image];

            });

     

    @interface PDPhotoGraphTool: NSObject

     

    + (void)saveImageToPhotos:(UIImage *)savedImage;

     

     

    + (void)image: (UIImage *) image didFinishSavingWithError: (NSError *) errorcontextInfo: (void *) contextInfo;

    @end

     

    @implementationPDPhotoGraphTool

     

    +(void)saveImageToPhotos:(UIImage *)savedImage

    {

       

        UIImageWriteToSavedPhotosAlbum(savedImage,self,@selector(image:didFinishSavingWithError:contextInfo:),NULL);

    }

     

    +(void)image:(UIImage *)image didFinishSavingWithError:(NSError *)errorcontextInfo:(void *)contextInfo

    {

        NSString *msg = nil ;

       

        if(error != NULL){

           

            msg = @"保存图片失败" ;

           

        }else{

           

            msg = @"保存图片成功" ;

           

        }

       

        UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@"保存图片结果提示"

                             

                                                       message:msg

                             

                                                      delegate:self

                             

                                              cancelButtonTitle:@"确定"

                             

                                              otherButtonTitles:nil];

       

        [alert show];

     

    }

    @end

  • 相关阅读:
    (八)DVWA之SQL Injection--SQLMap&Burp测试(Medium)
    (五)SQLMap工具检测SQL注入漏洞、获取数据库中的数据
    (四)SQLMap之Tamper篡改脚本的类型、作用、适用场景
    (七)DVWA之SQL Injection--SQLMap测试(Low)
    (三)SQLMap工具-使用选项的操作命令&功能
    20190923-13Linux企业真实面试题 000 021
    20190923-12Linux软件包管理 000 020
    20190923-11Linux crond 系统定时任务 000 019
    20190923-10Linux进程线程类 000 018
    20190923-09Linux磁盘分区类 000 017
  • 原文地址:https://www.cnblogs.com/llios/p/3921912.html
Copyright © 2011-2022 走看看