3

We have a mystery !

In our app we use only retina images (@2x marked). Until yesterday non-retina devices showed the images well even when we called the images without @2x at the end.

For example if the file name is 'fun@2x.png' we called [UIImage imageWithName:@"fun"].

Today it stopped working and now we have to call [UIImage imageWithName:@"fun@2x"] for the image to display. (The device is iPhone 3GS iOS 5.1).

We are now afraid that we don't understand something about the retina naming.

What changed ? What is the correct way to deal with it?

Thanks

Shani

4

2 回答 2

5

You should provide non-retina images! The downscaling isn't a good option. The problem here is that iOS tries to find the fun.png image and doesn't find it. Therefore can't present something.

I have no explanation why it worked before. Are you sure?

于 2012-12-27T15:14:52.573 回答
2

In apps I have worked on if I am only supplying 1 image (the 2x one) than I just use the full image name, ie:

[UIImage imageWithName:@"my-image.png"]

When I am supplying images for certain buttons that I need have 2 versions of, I use:

[UIImage imageWithName:@"my-image"]

Doing it this second way, you must supply a retina & non-retina image with that base name

Like dasdom said it should have not been working before that way-- and even if it somehow was you should stick to what I said above if you want your images to always display.

于 2012-12-27T15:20:59.187 回答