I read on the reference that from iOS version 4.+ with the method imageNamed
of UIImage
object, the file extension is not required.
From UIImage
class reference:
Special Considerations.
On iOS 4 and later, the name of the file is not required to specify
the filename extension. Prior to iOS 4, you must specify the filename
extension.
But it seems that this only work with PNG files.
If my code is:
[UIImage imageNamed:@"test"];
- The image loads only if the file is
test.png
- The image doesn't load if it's
test.jpg
.
For me it is a big problem because I need to maintain a dynamic image loading (I do not know at runtime if the image I want to load is png
or jpg
).
Please can you help me?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…