I’ve been using Core Plot to draw some charts for an iOS app I’ve been developing. While core plot is excellent as a charting application, it’s a performance hog when it comes to any kind of user interaction. To get around this, I started doing a lot of the following:
UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
I would then swap out the view for the image of the view before starting my animations, which made them far smoother.
Since then, I’ve started using this idea more in my app. I haven’t had much iOS experience before this project and haven’t really looked at much source from more expert developers. I just wanted to look for some feedback – am I missing the point by taking this approach?
I use this extensively in an OpenGLES animation framework I’ve been working on to render animations between views. I don’t know that you’re missing the point, but if you are, then I must be as well, as so long as it fits within what you want to do in your application, it seems to me like a good way to go about doing things.