首页 > 数据库技术 > 详细

SandBox沙盒

时间:2015-04-07 23:03:05      阅读:199      评论:0      收藏:0      [点我收藏+]

沙盒:应用程序之间互相隔离

应用程序只能访问自己本地的内容,不能访问其他app文件目录(越狱手机除外)

为应用程序有自己的缓存和备份数据

写法:NSString* homeDirectory = NSHomeDrirectory();

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

1.获得沙盒文件中的文件

项目中的资源文件,会打包到沙盒中,比如plist文件、图片资源(),或者加载xib中的文件

如获得XXX.plist文件的路径

NSBundle bundle = [NSBundle mainBundle];

NSString* plistPath = [bundle pathForResource:@"XXX"ofType:"plist"];

plistPath中包含了对应文件路径的字符串。

2.加载xxx.xib对象

NSBundle bundle = [NSBundle mainBundle];

NSArray * objs = [bundle loadNibName:@"singleView"owner:nil options:nil];

objs就包含了xib中所有的文件对象。

SandBox沙盒

原文:http://www.cnblogs.com/fanxinguu/p/4399856.html

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