中文国产日韩欧美视频,午夜精品999,色综合天天综合网国产成人网,色综合视频一区二区观看,国产高清在线精品,伊人色播,色综合久久天天综合观看

ObjectC,遍歷目錄 -電腦資料

電腦資料 時間:2019-01-01 我要投稿
【www.szmdbiao.com - 電腦資料】

    最近武漢連續(xù)下雨很多天,降溫了2次,溫度一下子由28度到14度,再到8度,手太冷了,

ObjectC,遍歷目錄

。

    加上最近發(fā)生了一些比較棘手的家庭瑣事,最近沒心情繼續(xù)學習Object-C。

    后來,我想明白了,心情不好的時候,還是應該堅持學習。

    郁郁寡歡,于事無補,該干嘛干嘛去~

    不開心的事情,總會過去的。等過去之后,該做的事情總是要繼續(xù)做的。

    因為不開心,浪費不少大好時間,才是雪上加霜的。

    計劃2015和2016年,初步掌握iOS開發(fā)。

    一個人可以獨自開發(fā)iOS應用,看得懂、能夠維護別人已經(jīng)寫好的APP。

    Android也是必須同時深入學習的。

    我現(xiàn)在的初步感覺是,Android上手容易,但是因為開源可以有更多內(nèi)容需要學習。

    而Object-C和iOS開發(fā),上手男很多,但是要學習的內(nèi)容會少很多。

    Mac,這么小的Mac,開發(fā)打字效率好低啊,讓人著急額~最近搞得多了,稍微快了一些。

////  main.m//  FilePath////  Created by fansunion on 15/11/29.//  Copyright (c) 2015年 demo. All rights reserved.//#import<foundation foundation.h="">//enumeratorAtPath 遍歷目錄,如果目錄下有目錄,遞歸遍歷//contentsOfDirectoryAtPath 只遍歷目錄//比較尷尬的是,“當前工作目錄”下,只有1個文件,有點奇怪//所以最后手動,遍歷“/Users/fansunion”/下的文件,只能簡單地看看這個目錄下的文件(目錄)列表int main(int argc, const char * argv[]) {    @autoreleasepool {        NSString *currentPath;        NSString *tempPath;        NSFileManager *fm;        NSDirectoryEnumerator *dirEnum;        NSArray *dirArray;                //文件管理器的實例        fm = [NSFileManager defaultManager];        //獲取當前工作目錄的路徑        currentPath = [fm currentDirectoryPath];        NSLog(@"The Path is %@!",currentPath);        //枚舉目錄        dirEnum =[fm enumeratorAtPath:currentPath];        while((tempPath=[dirEnum nextObject])!= nil){            NSLog(@"%@",tempPath);        }                //另外一種枚舉目錄的方法        dirArray= [fm contentsOfDirectoryAtPath:currentPath error:NULL];        NSLog(@"%@",dirArray);        for(tempPath in dirArray){             NSLog(@"%@",tempPath);        }                dirArray =[fm contentsOfDirectoryAtPath:@"/Users/fansunion" error:NULL];        NSLog(@"%@",dirArray);    }    return 0;}</foundation>

    程序輸出

    2015-11-29 13:02:49.528 FilePath[2750:159478] The Path is /Users/fansunion/Library/Developer/Xcode/DerivedData/FilePath-dfjiajapcipfrbcbfjmxijqhscws/Build/Products/Debug!

    2015-11-29 13:02:49.534 FilePath[2750:159478] FilePath

    2015-11-29 13:02:49.534 FilePath[2750:159478] (

    FilePath

    )

    2015-11-29 13:02:49.534 FilePath[2750:159478] FilePath

    2015-11-29 13:02:49.535 FilePath[2750:159478] (

    ".bash_history",

    ".CFUserTextEncoding",

    ".DS_Store",

    ".ssh",

    ".subversion",

    ".Trash",

    Desktop,

    Documents,

    Downloads,

    Library,

    Movies,

    Music,

    Pictures,

    Public

    )

    Program ended with exit code: 0

最新文章