Re: [問題] 有了地址但不知道怎麼轉成TableView
※ 引述《zonble (zonble)》之銘言:
: ※ 引述《man27382210 (鹽です)》之銘言:
: : 如題...
: : 我日前用
: : NSArray *paths =
: : NSSearchPathForDirectoriesInDomains
: : (NSDocumentDirectory, NSUserDomainMask, YES);
: : NSString*documentDirectory = [paths objectAtIndex:0];
: : 取得到Documents的資料夾路徑
: : 但不是很清楚要怎麼把這裡面的東西列在TableView上
: NSFileManager -enumeratorAtPath:
: 簡單來說
: NSDirectoryEnumerator *e = [[NSFileManager defaultManager] -enumeratorAtPath:documentDirectory];
: NSString *filename = nil;
: while (filename = [e nextObject]) {
: // filename 就是檔名,看你想怎麼顯示
: }
我最後是用這個方法
NSString *paths = [NSHomeDirectory() stringByAppendingPathComponent:
@"Documents"];
fileList = [[[[NSFileManager defaultManager]
contentsOfDirectoryAtPath:paths error:nil]
pathsMatchingExtensions:[NSArray arrayWithObjects:
@"txt", @"jpg", nil]] retain];
不過老實說我是查書的 我不是很懂第二句那串長長的式子意義到底是什麼
@"txt",@"jpg"那邊倒是不用說了@@
請教版上的高手有沒有比較適合解讀的寫法
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.45.184.101
→
03/19 18:06, , 1F
03/19 18:06, 1F
→
03/19 18:07, , 2F
03/19 18:07, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章