1
votes

In previous iOS SDK, [UIImage imageNamed:] can determine the image to load automatically without giving the file extension, for example:

[ivTest setImage:[UIImage imageNamed:@"testImage"]];

It will search for appropriate image to load (i.e. testImage.jpg & [email protected]). But for iOS 8, it sometimes cannot identify the correct image to load, and just returns null.

I have to specify the extension:

[ivTest setImage:[UIImage imageNamed:@"testImage.jpg"]];

But this happens only in same rare cases.

Given that I have only the following images in the project:

No other images with similar names. How can I prevent this? Should I specify extension for all my imageNamed: ?

1
Are the images in a .xcassets?dasdom
Place the images inside images.xcassets.Sandeep
Yes, I think you have to specify the filename extension for all JPEG. That paragraph above is reference from apple document.KudoCC
@Raptor yes, you do. You have to have the files named "blah" and "blah@2x". It's up to you though. It's easy to switch to. It's been around for two years. It makes managing images easier. It doesn't require any code changes. It will help with iOS8 3x images. But I can understand if you don't want to use it... no wait... lolFogmeister
@Raptor it also helps to validate your icon images and launch images.Fogmeister

1 Answers

3
votes

Reference from here

On iOS 4 and later, if the file is in PNG format, it is not necessary to specify the .PNG filename extension. Prior to iOS 4, you must specify the filename extension.

So the answer is you have to specify the filename extension for all JPEG.

About Asset Catalog, well, to tell the truth I don't have any ideas about that, let's study it later.