zoukankan      html  css  js  c++  java
  • UIImageWriteToSavedPhotosAlbum将应用中的图片保存到用户iPhone或者iTouch的相册中

    - (void)savePicToPhotoes

    {

        UIGraphicsBeginImageContext(self.view.bounds.size);

        CGContextRef ref = UIGraphicsGetCurrentContext();

        [_board.layer renderInContext:ref];

        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

        UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

    }

    #pragma mark 显示提示框

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

        //创建alert

        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"图片已保存到相册" message:nil preferredStyle:UIAlertControllerStyleAlert];

        //创建action

        UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];

        [alert addAction:action];

        [self presentViewController:alert animated:YES completion:nil];

    }

  • 相关阅读:
    java位运算
    java笔试题(面试题)系列之一
    Java数据类型转换总结
    ++a和a++
    Java IO
    Java 并发
    Java位运算及补码存储
    Redis 5.0.0安装部署(伪集群版)
    Redis 安装(单机版)
    Dubbo源码分析系列之【服务暴露】
  • 原文地址:https://www.cnblogs.com/ITliufei/p/5753128.html
Copyright © 2011-2022 走看看