我的代码列在下面。我该怎么做?在iPhone4上加载@ 2x图像失败?
UIImage *image = [UIImage imageWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"back"
ofType:@"png"
inDirectory:@"data/ui/button"]];
与代码一个伟大的文章:http://atastypixel.com/blog/uiimage-resolution-independence-and-the-iphone-4s-retina-display/
我有几个注意事项:1.由imageNamed加载的图像文件将被缓存,并且永远不会释放。我选择imageWithContentsOfFile:保存内存占用量; 2.我的应用程序拥有将近100个UI资源图像(并且数字将以@ 2x文件加倍),将它们全部放在包的根目录下是不错的选择?是的,文章中提出的解决方案并不完美。 – 2010-08-28 16:15:08