O'Reilly logo

The Core iOS Developer’s Cookbook, Fifth Edition by Rich Wardwell, Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recipe: Building a Custom Lock Control

We created the lock control you see in Figure 2-8 for a conference after wrapping up the last edition of this Cookbook. At that time, numerous people asked for this recipe to be included in the next edition. It’s surprisingly easy to build from a UIControl point of view. It consists of four elements: a backdrop, the lock image (which switches to an unlocked version on success), the drag track, and the thumb.

Image

Figure 2-8 This simple lock control unlocks and removes itself after the user successfully swipes across at least three-quarters of the way.

Recipe 2-9 shows the code that creates this control’s behavior. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required