沙盒目錄

        //應用程序主目錄(沙盒目錄 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];

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章