Loading an ico image switches red channel with the blue one

This is what I do: I have a favicon.ico in my resources (for example http://google.com/favicon.ico)

Then I have a UIImageView which loads that image.

self.imgTestIcon.image = [UIImage imageNamed:@"favicon.ico"];

The image showed in the simulator or the in iPhone is the same but with the red color switched with the blue one. Could it be a loading bug from apple?

I also have the same result downloading directly from Internet:

self.imgTestIcon.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://google.com/favicon.ico"]]];

Thanks David.


I have found this work around:

icon = [UIImage imageWithContentsOfFile:path];
icon = [UIImage imageWithData:UIImagePNGRepresentation(icon)];

Basically file is loaded and then converted it to an PNG UIImage, and it works. Anyway I also used the Libnsbmp library and then some Quartz code to integrate it, it worked fine but I think that the work around runs faster.

Sounds like it might be a legitimate bug.

You could include an ICO reading library in your app if this is an essential feature (Libnsbmp is one example)

Need Your Help

Changing properties of Java Window Objects inside action listeners

java eclipse swing windowbuilder

I have been using WindowBuilder in Eclipse, and have added an action listener to a button (btn1).

Resize a Drawable object in Android

android xml android-layout android-studio screen

I am generateing list of app icons at runtime process and storing it in a Drawable object like this: