I have an old app and created @2x high res images for it. Now I've incorporated all these into my project, but when I build and run the app on the retina display test device I do not see the high res images.
To be sure, I made some of them with strange colors so I know exactly if @2x is used or not. I also tried to clean my build and all targets first. It just seems the device is refusing to use high res images.
Must I set a flag in the info.plist?
it's a known issue with imageWithContentsOfFile:
. In API docs, it says it should work, in reality it doesn't (didn't work in 4.0.x, not sure about newer). They'll fix it one day.
Apple bug: http://openradar.appspot.com/8160592
Ugly, but a good workaround: http://hi.baidu.com/myguru/blog/item/11d12587e7c92524c65cc3ad.html
Make sure you're using [UIImage imageNamed: @"name"]
. If you're using a device with a Retina display, it automatically appends the filename with @2x
so it loads the right image.
How are you accessing the images? Anything placed into a UIImageView or UIButton, or retrieved with +[UIImage imageNamed:] should work fine. Are you sure your @2x images are EXACTLY 2 times the height and width of the originals?
来源:https://stackoverflow.com/questions/3742618/how-to-activate-2x-high-res-graphics-for-retina-display