首页 > 代码库 > 沙盒目录
沙盒目录
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];
沙盒目录