[[NSBundle mainBundle]pathForResource..取值为空
来源:互联网 发布:linux环境下面安装字体 编辑:程序博客网 时间:2024/06/05 17:26
最近遇到一个奇葩的问题,使用[[NSBundle mainBundle]pathForResource:imageName ofType:@"png"];
获取图片一直取不到图片,简直晕死,一直好用的方法突然不行了,只能另寻它法了。
这里提出一个解决方案仅供参考。
1、以实体文件的方式拖入图片文件夹
2、以实体文件的方式查找
NSString *path = [[NSBundle mainBundle]pathForResource:imageName ofType:@"png" inDirectory:@"images"];
如果以上方式还无法正确读取到文件可以继续下一步:
3、设置Bundle Resource, 选中工程->Build Phases->Copy Bundle Resources
再次尝试应该就阔以啦。
阅读全文
0 0
- [[NSBundle mainBundle]pathForResource..取值为空
- [[NSBundle mainBundle]pathForResource..取值为空
- iOS开发.[NSBundle mainBundle] 通过pathForResource返回路径为空.
- iOS开发.[NSBundle mainBundle] 通过pathForResource返回路径为空.
- iOS开发 [NSBundle mainBundle] 通过pathForResource返回路径为空.
- iOS开发中 [[NSBundle mainBundle] pathForResource: ofType:]路径为空的问题
- [[NSBundle mainBundle]pathForResource:@"XXX" ofType:@"db"]为nil的解决办法
- NSBundle pathForResource取不到值
- NSBundle pathForResource取不到值
- NSBundle pathForResource取不到值如何解决?
- NSBundle pathForResource取不到值问题
- NSBundle pathForResource取不到值如何解决?
- NSBundle pathForResource取不到值如何解决?
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- NSBundle mainBundle] pathForResource 返回nil的解决办法
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- [[NSBundle mainBundle]pathForResource:@"name" ofType:@"type"] 获取不到本地文件
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- Spring MVC DispatcherServlet详解
- mysql忘记密码怎么重置
- 第五周周中总结
- 9-28 DAIRY
- 机器学习作业1
- [[NSBundle mainBundle]pathForResource..取值为空
- 字符串匹配-扩展KMP
- jsp页面的doGet()方法和doPost()方法
- 文章标题 动画Html
- 2017/9/28总结
- 【Python】2.x与3.x区别
- content-type
- Lambda表达式之map reduce & groupingBy
- 新人第一次用html做的页面