UIImage imageNamed not working on ios 5.0
I am using this code:
[image setImage: [UIImage imageNamed: @ " some@2x.png "]];
and it works on ios 4.3 but on ios 5.0 I can't see my image.
Does anyone know what exactly this problem is?
+3
Matrosov alexander
source
to share
2 answers
You usually don't need to include @ 2x in the name - iOS should automatically pick the correct filename (some.png or some@2x.png ) depending on the screen scale. Have you tried this:
[image setImage:[UIImage imageNamed:@"some.png"]];
instead
+6
Martin Gjaldbaek
source
to share
As Martin (another :)) said, you shouldn't add @ 2x if you have both yourImage.png and yourImage@2x.png.
I have also listed many causes of problems that imageNamed can cause here
+1
Martin
source
to share