I'm using core-plot library to draw graphs. For some animation I have to take the image snapshot of the entire screen in order to make it smooth. The problem is that when I try to get image from the graph. The graph is always upside down. If I took only the graph itself as the snapshot, then it wouldn't be a problem - i could easily apply a transform on it. The problem is, I'm animating the whole screen, so that I take the snapshot of the entire UIWindow which consists the graph in one of its subviews. I tried it with the coreplot 0.2.2 sample available in coreplot project on code.google. I simply added one button to the window (so that it is visible on each tab), when the button is pressed, I take the image from the window content and save is as an image in the Album library using this code:
UIView *window = [[UIApplication sharedApplication] keyWindow];
UIGraphicsBeginImageContext(window.frame.size);
[window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(newImage, nil, NULL, NULL);
The result is as described above. Graph in the generated image is rendered upside down compared to the one that is visible on the screen. Do I do sth wrong or that's core-plots bug?