首页 > 其他 > 详细

沙盒目录

时间:2014-12-21 11:31:52      阅读:286      评论:0      收藏:0      [点我收藏+]
        //应用程序主目录(沙盒目录 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];

沙盒目录

原文:http://blog.csdn.net/loseway711/article/details/42059003

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