我的代碼列在下面。我該怎麼做?在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