shannoga
shannoga

Reputation: 19869

Explicitly add @2x to non retina devices

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 '[email protected]' 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

Upvotes: 3

Views: 245

Answers (2)

RyanG
RyanG

Reputation: 4503

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.

Upvotes: 2

dasdom
dasdom

Reputation: 14073

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?

Upvotes: 5

Related Questions