pathforresource专题

NSBundle pathForResource取不到值问题

NSBundle pathForResource取不到值问题 一、问题描述: 初学UI,照着视频敲汤姆猫项目,做到加载图片(含jpg格式)时有两种方法可以实现一种是有缓存,一种是没有缓存。代码实现如下: 1.imageNamed: 有缓存(传入文件名)

[NSBundle mainBundle] pathForResource: ofType: 获取不到数据

从bundle中获取数据,明明把数据添加到项目中了,但就是不对。      NSString *newDataName = [[NSBundle mainBundle] pathForResource:dataName ofType:format];  为空      后来从网上查到相关信息,当时添加是直接拖拽过去,没有真正加入到bundle中,需要在项目设置中,build p