Explicitly Using @2x images in an iPad xib in Interface Builder
I've got 2 sets of images in my project, one set for old displays and one @2x set for retina displays. I'm working on the iPad xibs (it's a universal app) and the double sized images that are @2x would actually work just fine for the ipad. If the image.png is 300 pixel开发者_Python百科s wide, the image@2x.png is 600 pixels wide, so on the 768 wide iPad screen that would work just fine. When I put a UIImageView in my iPad xib, I try to set the Image Name to explicitly be image@2x.png, but I get the ?? image which means that Interface Builder doesn't know what it is.
When I launch the simulator it does actually show the @2x image, so it is technically working, but Interface Builder won't show it to me properly and that makes it difficult to create the layout.
Is there a way to get Interface Builder to show me the @2x image when I'm making an iPad xib?
The way it works is that Interface Builder automatically chooses the right one for your device. You cannot explicitly change that as it is against its existence.
Images can be named with a ~iPad to specify that they should be used when running on the iPad. For example, you could have these images: myImage.png myImage@2x.png myImage~iPad.png
The first will get used on the iPhone 3GS and below, the second on the iPhone 4, and the third on the iPad.
精彩评论