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"]]];
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)