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)
  • 相关阅读:
    java——阶段性整理(方法的重载重写和一些关键字)
    设计模式——单例模式
    source
    set和setenv
    c++编译加执行脚本
    python脚本小记
    转义字符
    istream_iterator/ostream_iterator
    字符串替换程序 p324
    程序编译后运行时的内存分配
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4552631.html
Copyright © 2011-2022 走看看