Spinning with CABasicAnimation

In this section, you are going to use an animation object to spin the implicit layer of the time field in HypnoTime’s CurrentTimeViewController whenever it is updated (Figure 23.4). (Recall that an implicit layer is a layer created by a view when the view is instantiated. The time field is a UILabel, which is a subclass of UIView, so it has an implicit layer that we can animate.)

Figure 23.4  Current time mid-spin

Current time mid-spin

Open HypnoTime.xcodeproj.

The Core Animation code you will write in this exercise will be in CurrentTimeViewController.m. So import the header from the QuartzCore framework at the top of this file.

#​i​m​p​o​r​t​ ...

Get iOS Programming: The Big Nerd Ranch Guide, Second 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.