iOS-NSBundle、NSArray、NSDictionay

NSBundle、NSArray、NSDictionay

读取plist文件

NSDictionary  *dict= [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"fileName" ofType:@"plist"]];

NSArray*arr=[NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"fileName" ofType:@"plist"]];

 读取后缀为.bundle的文件

NSString *bundlePath = [[[NSBundle mainBundle]bundlePath]stringByAppendingPathComponent:@"xx.bundle"];

NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];

NSString *path = [bundle pathForResource:imageName ofType:@"png"];

UIImage *image=[UIImage imageWithContentsOfFile:path];

 NSString *path = [[NSBundle mainBundle]pathForResource:@"xx" ofType:@”plist”];
NSURL *url =  [[NSBundle mainBundle] pathForResource:@"xx " ofType:@"plist"];
原文地址:https://www.cnblogs.com/linxiu-0925/p/5055608.html