I have a graph that I have done with the opensource framework core-plot. It works perfect, and now I want the user to be able to mail this graph. I therefore take the view of the graph and turn it to an UIImage and then save it to the sandbox for the mail-class to pick it up.
With this little nifty code I turn the UIView into a UIImage: "self" being the class of the Graph (Core-plot class). In other words, I take a "screenshot" of the graph view for the user to mail:
Code:
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
All works fine, until I try to mail it. The Graph-image is both mirrored AND turned upsidedown. If this wasn't enough, it doesn't respond to any code at all, it doesn't matter what I write, it's still mirrored. I've tried everything in my power and now I need help.