iOS實用小技巧 2 生成txt文字

2022-06-12 12:09:07 字數 1379 閱讀 1015

3456

78910

1112

1314

1516

1718

1920

2122

2324

//不論是建立還是寫入只需呼叫此段**即可 如果檔案未建立 會進行建立操作

- (void)writetofilewithtxt:(nsstring*)string

nslog(@"所寫內容=%@",string);

nsfilehandle*filehandle = [nsfilehandlefilehandleforupdatingatpath:thefilepath];

[filehandle seektoendoffile];//將節點跳到檔案的末尾

nsdata* stringdata  = [[nsstringstringwithformat:@"%@\n",string] datausingencoding:nsutf8stringencoding];

[filehandle writedata:stringdata];//追加寫入資料

[filehandle closefile];

}

});

}

1,獲得內容

nsarray *dictionary = [nsarray arraywithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"diseaselistdata" oftype:@"plist"]];

3,把內容儲存到txt檔案

[dictionary writetofile:filepath atomically:yes];

nslog(@"%@",[nsbundle mainbundle].resourcepath);

Excel XP小技巧。。實用一生

一 工作簿操作技巧 1.開啟固定工作簿 如果您有幾個固定的工作簿需要同時開啟,可以將它們儲存為工作區。以後只要將工作區開啟,excel就會開啟其中的每個工作簿。儲存工作區的方法是 開啟需要同時使用的多個工作簿,按照使用要求調整好視窗大小和位置。再單擊excel 檔案 選單下的 儲存工作區 命令,輸入...

CLR筆記 2 生成,打包,部署,管理

2.1 net framework部署目標 非.net程式的問題 1.dll hell 2.安裝複雜。目錄分散,登錄檔,快捷方式 2.2 將型別整合到模組中 編譯器工具csc csc out program.exe t exe r mscorlib.dll program.cs 由於c 會自動引用m...

Ionic2生成網頁工作原理

ionic2生成網頁工作原理 由於專案需要,沒有使用android原生開發,而是使用了現在流行的hybird開發技術。經過選擇最終選擇了ionic1,學習了一段時間,發現了官網的文件函式在ionic1,沒有實現相應的效果。才發現原來得使用ionic2,新版的框架。因此,現在專案使用ionic2開發。...