Recipe: Bouncing Views as They Appear

Apple often uses two animation blocks, one called after another finishes, to add bounce to animations. For example, a view might zoom into a view a bit more than needed and then use a second animation to bring that enlarged view down to its final size. Bounces add a little more life to your animation sequences, providing an extra physical touch.

When calling one animation after another, be sure that the animations do not overlap. The easiest way to ensure this is to use a nested set of animation blocks with chained animations in the completion blocks. Recipe 4-10 uses this approach to bounce views slightly larger than their end size and then shrink them back down to the desired frame.

This recipe uses two ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.