NSBundle

NSBundle

作用:用来访问与之对应的资源包内部的文件,可以用来获得文件的全路径

一个NSBundle对象对应一个资源包(图片,音频,视频,plist等文件)

项目中添加的资源都会被添加到主资源包中:[NSBundle mainBundle]

NSBundle *bundle = [NSBundle mainBundle];
NSString *file = [bundle pathForResource:@"shops" ofType:@"plist"];
self.shops = [NSArray arrayWithContentsOfFile:file];

你可能感兴趣的:(NSBundle)