天天看點

沙盒檔案夾

        //應用程式主檔案夾(沙盒檔案夾 sandbox)

        NSString *homePath = NSHomeDirectory();

        NSLog(@"%@",homePath);

        //應用程式主資源包的路徑,應用程式中的資源,在應用程式第一次執行中,會自己主動複制到應用程式的主資源包中

        NSString *appPath = [[NSBundle mainBundle]bundlePath];

        NSLog(@"%@",appPath);

        //讀取家檔案夾中Documents檔案夾

        NSString *docuPath = [homePath stringByAppendingString:@"/Documents"];

        NSLog(@"%@",docuPath);

        //擷取temp檔案夾

        NSString *tmp = NSTemporaryDirectory();

        NSLog(@"%@",tmp);

        //擷取主資源包資源資料(圖檔資源在黃色檔案夾中的擷取方法)

        NSString *picPath = [[NSBundle mainBundle]pathForResource:@"17_1" ofType:@"jpg"];

        NSString *picPath2 = [[NSBundle mainBundle]pathForResource:@"17_2" ofType:@"jpg" inDirectory:@"images"];

        NSString *picPath3 = [[NSBundle mainBundle]pathForResource:@"/images/17_2.jpg" ofType:nil inDirectory:nil];

繼續閱讀