关于 imageWithContentsOfFile @2x图片显示不出的问题
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"homeIcon@2x" ofType:@"png"]] 这样是OK的
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"homeIcon" ofType:@"png"]] 这样则无效
原因是:
means that you have a pair of graphics files for any resource - both "filename.png" and "filename@2x.png". Or, alternatively, it can be used as "alias" for only "filename.png" If you have only "filename@2x.png", you have two possible variants: 1. Use something like that
也就是当你的文件里同时存在 filename.png 和 filename@2x.png文件 的时候 才能直接用"filename.png"