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)
  • 相关阅读:
    iOS6后的内存警告处理
    key things of ARC
    敏捷软件开发Note
    ViewController的属性
    sizeToFit & sizeThatFits
    iOS静态库的制作与引用
    xcode添加build phase
    什么是HUD
    xcode中的预定义宏
    管理授权&管理决策&管理组织&管理目标
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4552631.html
Copyright © 2011-2022 走看看