Widget “flip” behavior in Core Animation/Cocoa

Mike Lee has an implementation of the flip effect for which he has released some sample code. (Unfortunately, this is no longer available online, but Drew McCormack built off of that in his own implementation.) It appears that he grabs the layers for the “background” and “foreground” views to be swapped, uses a CATransform3D to rotate the two views in the animation, and then swaps the views once the animation has completed.

By using the layers from the views, you avoid needing to cache into a bitmap, since that’s what the layers are doing anyways. In any case, his view controller looks to be a good drop-in solution for what you want.

Leave a Comment