zoukankan      html  css  js  c++  java
  • 图片保存到本地相册

    将图片保存到本地的相册中:

    //保存
    -(void)SaveAction{
        //保存到本地相册
        UIImageView *imgVCSave=[[UIImageView alloc]init];
        [imgVCSave setImageWithURL:[NSURL URLWithString:[_array_picURL objectAtIndex:_select_row]]];
        UIImageWriteToSavedPhotosAlbum(imgVCSave.image, self, @selector(imageSaveToPhoto:didFinishSavingWithError:contextInfo:), nil);
    }
    
    
    - (void)imageSaveToPhoto:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
    {
        NSString *message;
        if (!error) {
            message = @"成功保存到相册";
             [SVProgressHUD showSuccessWithStatus:message];
        }else
        {
            message = [error description];
        }
        NSLog(@"message is %@",message);
       
    }

    看一下官方文档:

    image

    The image to write to the Camera Roll album.

    completionTarget

    Optionally, the object whose selector should be called after the image has been written to the Camera Roll album.

    completionSelector

    The method selector, of the completionTarget object, to call. This optional method should conform to the following signature:

    - (void)               image: (UIImage *) image
        didFinishSavingWithError: (NSError *) error
                     contextInfo: (void *) contextInfo;
    contextInfo

    An optional pointer to any context-specific data that you want passed to the completion selector.

    Availability iOS (2.0 and later)
  • 相关阅读:
    宏任务与微任务
    reactnative 自定义项目的图标库
    react-native中textInput在androidTV上的焦点处理(坑篇)
    js中!!的运用
    ES6里class杂乱随笔
    浅析链式调用
    link和@import的区别
    ES2020链判断运算符?.和Null判断运算符??
    vue组件使用name属性来生成递归组件
    k8s学习——相关概念
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4552631.html
Copyright © 2011-2022 走看看