-(void)saveImage:(UIImage*)image{
    NSString  *pngPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.png"];
    NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.jpg"];
    
    // Write a UIImage to JPEG with minimum compression (best quality)
    // The value 'image' must be a UIImage object
    // The value '1.0' represents image compression quality as value from 0.0 to 1.0
    [UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPath atomically:YES];
    
    // Write image to PNG
    [UIImagePNGRepresentation(image) writeToFile:pngPath atomically:YES];
    
    // Let's check to see if files were successfully written...
    
    // Create file manager
    NSError *error;
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    
    // Point to Document directory
    NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    
    // Write out the contents of home directory to console
    NSLog(@"Documents directory: %@", [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&error]);
    
}

最新文章

  1. mysql练习题-查询同时参加计算机和英语考试的学生的信息-遁地龙卷风
  2. EventBus--出现的问题
  3. 如何去掉Eclipse里面自动追加的一些注释!!!内详
  4. React和ES6(二)ES6的类和ES7的property initializer
  5. WebDriver兼容SeleniumRC(基于C#)
  6. swift学习笔记之-自动引用计数
  7. JAX-RS 2.0 REST客户端编程实例
  8. 分布式全局不重复ID生成算法
  9. linux里的bootproto的none,static,dhcp有什么区别
  10. git将本地项目添加到github远程仓库
  11. www.iis.net
  12. MAC平台下mysql7.5的安装
  13. MongoDB学习总结(四) —— 索引的基本用法
  14. 利用wget检测网页是否正常访问
  15. hdu5893 List wants to travel
  16. 使用python UIAutomation从QQ2017(v8.9)群界面获取所有群成员详细资料,
  17. Swift之GCD使用指南1
  18. windows10下Kafka环境搭建
  19. day26_python_1124
  20. Mysql性能优化二:索引优化

热门文章

  1. Linux磁盘配额实验
  2. LWIP_STM32_ENC28J60_NETCONN_TCP_CLIENT(4)
  3. 第三弹:ZFNet
  4. 你会做Web上的用户登录功能吗?
  5. Java使用POI实现数据导出excel报表
  6. Thinking in scala (7)---- f(n)=f(n-1)+2f(n-2)+3f(n-3)
  7. Eclipse上Spring-tool的安装
  8. 【ural1297】 Palindrome
  9. 【推荐】PHP中格式化时间函数date与gmdate的区别 | 修改PHP的默认时区
  10. PHP检测获取内存信息