Documents目錄下得增刪改查

2022-08-13 11:21:11 字數 711 閱讀 4527

//在documents目錄下建立乙個名字為myfile的資料夾

2. nslog(@"%@",path); 

//返回檔案管理的乙個單例

3. nsfilemanager *filemanager = [nsfilemanager defaultmanager];      

4.  bool isdir = false;      

5.  bool isdirexist = [filemanager fileexistsatpath:path isdirectory:&isdir];

6.     if(!(isdirexist && isdir))          

nslog(@"建立資料夾成功,檔案路徑%@",path);    }

7.   uiimage *image=[uiimage imagewithcontentsoffile:@"myimage.png"];

nsdata *data = uiimagepngrepresentation(image);

8.    //將myimage.png儲存到myfile資料夾下,新名稱為image.png

11. //獲取儲存的    

12 //   刪除檔案

bool isdelete=[filemanager removeitematpath:path error:nil];

nslog(@"%d",isdelete);

ios訪問Documents目錄下的檔案的注意點

ios訪問documents目錄下的檔案,注意 1 拼接的路徑字串是否正確 2 拼接的路徑的方式 第一種,字串變數 字串常量 拼接 demo1 nsstring path nsstring stringwithformat docpath,23.png demo2 nsstring document...

根目錄下常用目錄作用

根目錄下常用目錄作用 home 普通使用者的主目錄。bin 使用者常用的命令 應用程式 sbin 超級使用者經常使用的一些命令。etc 存放作業系統和應用程式的配置檔案。etc rc.d 啟動的配置檔案和指令碼 etc passwd 使用者名稱,密碼之類的使用者資料。etc shadow 對使用者資...

根目錄下常用目錄作用

2019獨角獸企業重金招聘python工程師標準 根目錄下常用目錄作用 home 普通使用者的主目錄。bin 使用者常用的命令 應用程式 sbin 超級使用者經常使用的一些命令。etc 存放作業系統和應用程式的配置檔案。etc rc.d 啟動的配置檔案和指令碼 etc passwd 使用者名稱,密碼...