How do I get the best result with images in UIButton and UITableViewCell for both iPhone and iPhone 4 retina?
Do I simply check for screen size and use twice the r开发者_StackOverflow中文版esolution for the iPhone 4, or do I need to tell the UIButton/UITableViewCell to render the image in high resolution?
Thank you
If you're setting the image in Interface Builder or loading it using +[UIImage imageNamed:]
, simply add a double resolution image to your project with a "@2x" suffix. (For example myimage.png
would be myimage@2x.png
.) The OS will take care of the rest for you.
See Updating Your Image Resource Files for more details.
If you include a high-resolution version of the image with the same name, but with @2x
before the extension, iOS will automatically choose the correct resolution according to display resolution, as long as you use the [UIImage imageNamed:]
function, or set the image in IB.
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html%23//apple_ref/doc/uid/TP40006556-CH14-SW1
精彩评论