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

最新文章

  1. 工作中总结的常用PHP代码
  2. WinForm窗体嵌入
  3. DOM(九)使用DOM设置文本框
  4. C#学习笔记思维导图 一本书22张图
  5. Swift学习(四)常量&变量&基础数据类型
  6. 【BZOJ】【1022】【SHOI2008】小约翰的游戏John
  7. mysql_insert_id 为什么会返回空值
  8. UVALive 3027 并查集
  9. 整理一些提高C#编程性能的技巧
  10. MySQL数据库— 汇总和分组数据
  11. Java中的方法
  12. 配置linux软件下载跟新地址
  13. Python:怎样用线程将任务并行化?
  14. 深入JVM分析spring-boot应用hibernate-validator
  15. BZOJ2300[HAOI2011]防线修建——非旋转treap+凸包(平衡树动态维护凸包)
  16. 【python】命令行神器 Click 简明笔记
  17. JSOUP如何POST只含JSON格式的数据
  18. What is the difference between concurrency, parallelism and asynchronous methods?
  19. Android Handler 消息处理使用
  20. Python入门-散点图绘制

热门文章

  1. 如何在C中传递二维数组作为参数?
  2. oracle数据库中 impdb/expdb 详解
  3. Educational Codeforces Round 75 (Rated for Div. 2) C. Minimize The Integer
  4. ADB命令使用详解
  5. PHP实现多文件上传的一些简单方法
  6. Linux 查看实时网卡流量的几种方式
  7. Gym - 102346G Getting Confidence 最小费用最大流
  8. (7)打造简单OS-加载内核
  9. win10下交换CapLock和Esc按键
  10. CF1188B Count Pairs