首页 > 移动平台 > 详细

ios取沙盒(sandbox)中的路径

时间:2014-03-30 16:54:43      阅读:464      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
NSString * str=  NSHomeDirectory();//取得当前应用在硬盘上得位置/一直到了hash码,ios中hash码代表一个应用
NSLog(@"%@",str);
str= [[NSBundle mainBundle]bundlePath];//一直到了hash码下面的.app文件//这个就是编译好的2进制程序
NSLog(@"%@",str);
str= [[NSBundle mainBundle]pathForResource:@"1" ofType:@".png"];//返回的就是沙盒中的资源路径
NSLog(@"%@",str);
str=  [[NSBundle mainBundle]pathForResource:@"1.png" ofType:nil inDirectory:@"images"];//后面这个文件夹表示的如果是引用的一个路径就需要,就是copy一个图片到项目中用的是引用,不是真的copy进来
NSLog(@"%@",str);
NSArray *arry1=NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask,YES);//在这个应用下找任何路径都可以
str =  [arry1 objectAtIndex:0];
NSLog(@"%@",str);
bubuko.com,布布扣

ios取沙盒(sandbox)中的路径,布布扣,bubuko.com

ios取沙盒(sandbox)中的路径

原文:http://www.cnblogs.com/liyang31tg/p/3633472.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!