NSBundle mainBundle的问题

整个iOS 的 app是有四个文件夹的,Documents, Library ,xxx.app, temp这四个文件夹

通常我们只能通过searchPath的方式访问到这里面的三个,xxx.app文件夹需要通过mainBundle的方式访问

很多资源文件都是放在这里的,最近访问里面的资源文件的时候总是访问不到,之前没有这个问题。

 NSString *imagePath = [[NSBundlemainBundle] pathForResource:@"navbar_background@2x"ofType:@"png"];

    UIImage *image = [UIImageimageWithContentsOfFile:imagePath];

之前不加@2x这个后缀也是可以访问的,试了很久才发现现在这么干不行了,先记录下来。

 

posted on 2012-12-18 14:33  easonoutlook  阅读(839)  评论(0编辑  收藏  举报