Home > Blogs > Cocoa Tip of the Day, 1/18/10

Cocoa Tip of the Day, 1/18/10

Use CoreAnimation for caching.

As well as providing impressive visual effects, CoreAnimation extends the drawing model to (optionally) provide a separate backing store for each view.  This makes redrawing a window much faster, at the expense of some memory.  If you're finding drawing is too slow in a complex window, try assigning layers to some of the more complex views.  This is a lot less effort than optimising the drawing code, which may not even be possible if you didn't write the views.

For more tips, and more detail about this tip, please see my new book,
Cocoa Programming Developer's Handbook,
available in print and electronic formats.