I am using the UIGraphicsGetImageFromCurrentImageContext () function to capture the contents of the screen into a UIImage object (previously displayed in the image context). This works great for both the simulator and the real device, however, in the last resulting image there are several pixels with distorted colors, as shown here:
http://img300.imageshack.us/img300/2788/screencap.png
Notice the few fucsia pixels on the top navigation bar, on both sides of the search field and to the right of the button. There are also such pixels to the right of the lower left button.
The code I use to capture the screen into a UIImage object is pretty simple:
UIGraphicsBeginImageContext(self.view.window.frame.size);
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *anImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
It should be noted that all distorted graphics relate to custom PNG files used to draw the background of the search field, as well as the background of the buttons.
Does anyone know what could be causing this strange color distortion?
Yours faithfully,
source
share