本文转自http://blog.csdn.net/toddmi/article/details/8204102

  1. = (NSCachesDirectory, NSUserDomainMask, YES);
  2. = [cachePaths objectAtIndex:0];
  3. }
  1. = (NSCachesDirectory, NSUserDomainMask, YES);
  2. = [cachePaths objectAtIndex:0];
  3. }
  1. = (dirName);
  2. = ;
  3. = [NSFileManager defaultManager];
  4. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  5. = ;
  6. == YES &&  == YES) )
  7. = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
  8. = (dirName);
  9. = ;
  10. = [NSFileManager defaultManager];
  11. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  12. = ;
  13. == YES &&  == YES )
  14. = [fileManager removeItemAtPath:imageDir error:nil];
  15. = ;
  16. = [NSFileManager defaultManager];
  17. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  18. = ;
  19. == YES &&  == YES )
  20. = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
  21. = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
  22. = ;
  23. = [NSFileManager defaultManager];
  24. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  25. == YES &&  == YES )
  26. = [directoryPath stringByAppendingString : imageName];
  27. = [fileManager fileExistsAtPath:imagePath];
  28. = [NSData dataWithContentsOfFile : imagePath];
  1. = (dirName);
  2. = ;
  3. = [NSFileManager defaultManager];
  4. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  5. = ;
  6. == YES &&  == YES) )
  7. = [fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nil error:nil];
  8. = (dirName);
  9. = ;
  10. = [NSFileManager defaultManager];
  11. = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];
  12. = ;
  13. == YES &&  == YES )
  14. = [fileManager removeItemAtPath:imageDir error:nil];
  15. = ;
  16. = [NSFileManager defaultManager];
  17. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  18. = ;
  19. == YES &&  == YES )
  20. = [UIImagePNGRepresentation(image) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"png"]] options:NSAtomicWrite error:nil];
  21. = [UIImageJPEGRepresentation(image, 1.0) writeToFile:[directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", imageName, @"jpg"]] options:NSAtomicWrite error:nil];
  22. = ;
  23. = [NSFileManager defaultManager];
  24. = [fileManager fileExistsAtPath:directoryPath isDirectory:&isDir];
  25. == YES &&  == YES )
  26. = [directoryPath stringByAppendingString : imageName];
  27. = [fileManager fileExistsAtPath:imagePath];
  28. = [NSData dataWithContentsOfFile : imagePath];

IOS之文件夹创建、删除,图片在本地的保存和加载的更多相关文章

  1. Java 基础【13】 文件(文件夹) 创建和删除

    使用 java.io.file 创建文件(文件夹),算是 java 最基础的知识,但实战项目中还是需要知晓细节. 比如 File 类中的 mkdir() 和 mkdirs() 的区别. JDK API ...

  2. Linux_文件及文件夹[创建][复制][移动][删除][重命名]

    一.文件/文件夹创建 1.文件的创建 touch , vi/vim/nano , ... 语   法: touch [-acfm][-d <日期时间>][-r <参考文件或目 录&g ...

  3. Java 基础【16】 文件(文件夹) 创建和删除

    使用 java.io.file 创建文件(文件夹),算是 java 最基础的知识,但实战项目中还是需要知晓细节. 比如 File 类中的 mkdir() 和 mkdirs() 的区别. JDK API ...

  4. python (10) 文件夹的创建与文件夹的删除

    有时需要在代码中对文件或者文件夹 进行删除,或者添加 导入的包:import os,shutil 新建文件夹 import os,shutil path = os.getcwd() #获得当前目录 # ...

  5. 个人永久性免费-Excel催化剂功能第17波-批量文件改名、下载、文件夹创建等

    前几天某个网友向我提出催化剂的图片功能是否可以增加导出图片功能,这个功能我一直想不明白为何有必要,图片直接在电脑里设个文件夹维护着不就可以了么?何苦还要把Excel上的图片又重新导出到文件夹中?这个让 ...

  6. 循环读取文件夹中的图片matlab代码

    参考:http://blog.csdn.net/guoxiaojie_415/article/details/21317323:http://blog.csdn.net/qikaihuting/art ...

  7. Android 遍历sdcard中指定文件夹下的图片(jpg,jpeg,png)

    File scanner5Directory = new File(Environment.getExternalStorageDirectory().getPath() + "/scann ...

  8. Linux下的文件夹创建命令使用实践

    [文章摘要] 本文以实际的C源程序为样例,介绍了Linux下的文件夹创建命令(mkdir)的用法.为相关开发工作的开展提供了故意的參考. [关键词] C语言  Linux  文件夹创建  makefi ...

  9. 【Linux】centos7中 root家目录中perl5文件夹无法删除问题解决

    由于新项目上线,安装了一些perl的一些包 但是发现,在/root下有一个perl5/的文件夹,删除后,重新登录又会出现,很是烦人,而且他还没有内容,就是一个空文件 那么着手搞掉他 环境:centos ...

随机推荐

  1. 对于 TCP 三次握手的理解

    假设名叫 A 和 B 的两个人要进行通信,那么他们两人之间,首先要确保通信顺畅. 而确保通信顺畅,就要从 3 个维度,确定 8 个能力 3 个维度分别是: 1.人知道(A 知道.B 知道) 2.人(A ...

  2. RTX消息提醒工具设计文档

    为什么要做 项目上线后,系统依然由各业务模块负责人自己维护.而后台运行的各种业务服务结果,不能及时反馈到业务负责人.而等到客户反馈时则会太被动.为了能及时发现并解决项目问题,设计了该工具. 可利用资源 ...

  3. fpm打包神奇rpm包升级python2.7.16

    fpm打包神器参考文档:https://www.cnblogs.com/flintlovesam/p/6594635.html FPM的安装:安装ruby环境和gem命令: yum -y instal ...

  4. 创建OData Service(基于ASP.NET 4.6.1, EF 6),Part I:Project initialize

    由于ASP.NET Core 1处于RC阶段,加上OData WebAPI 对ASP.NET Core 1的跟进不是很积极,基于ASP.NET Core 1的Alpha 1版本已经N月没有check ...

  5. 打包上传被拒 Guideline 2.5.1 - Performance - Software Requirements

    打包上传被拒 Guideline 2.5.1 - Performance - Software Requirements 在项目中全部搜索:prefs:root 找到后,把这个私有的 NSURL *u ...

  6. tp5验证码的使用

    <div><img id="verify_img" src="{:captcha_src()}" alt="验证码" on ...

  7. [LC]141题 Intersection of Two Linked Lists (相交链表)(链表)

    ①中文题目 编写一个程序,找到两个单链表相交的起始节点. 如下面的两个链表: 在节点 c1 开始相交. 注意: 如果两个链表没有交点,返回 null.在返回结果后,两个链表仍须保持原有的结构.可假定整 ...

  8. [error]The command could not be located because '/usr/bin' is not included

    配置HBase环境变量的时候写错了,写成了如下: 之后便报错 解决: 系统命令找不到时,通常是路径不对,直接在命令行用全路径即可,配置环境变量时,加入自己的环境变量,还要附带上之前的变量.如最后加上: ...

  9. 0x8000FFFF 错误的解决方式

    问题描述: 在F盘新建文件夹或文件的时候提示0x8000FFFF灾难性错误: 解决方法: 1.在F盘的位置,右击选择属性 2.在弹出的窗口中选择工具,点击检查 3.根据系统提示进行响应的驱动扫描与修复 ...

  10. nyoj 198-数数 (python, string[::-1])

    198-数数 内存限制:64MB 时间限制:3000ms 特判: No 通过数:16 提交数:25 难度:2 题目描述: 我们平时数数都是喜欢从左向右数的,但是我们的小白同学最近听说德国人数数和我们有 ...