views:

22

answers:

2

Hello,

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.

A: 

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)

rpetrich
Thanks, I will see if I can adapt that to my project.
LightMan
I have made several tests, and not only the color channels are switched, there are also a lot of problems with the alpha channel information.
LightMan
A: 

I have found this walk 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 walk around runs faster.

LightMan