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"];

相关文章:

  • 2021-06-13
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-27
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案