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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With