Recipe: Creating a Pull Control
Imagine a cord at the top of your screen. Pull it hard enough, and it rings a bell or otherwise triggers some sort of event, via a control target-action mechanism. For example, it could roll out a secondary view, start a download, or begin video playback. Recipe 2-8 builds a control that resembles a ribbon. The control updates clients when the interaction, which must start on top of the “ribbon,” pulls down far enough to trigger a request. The ribbon winds itself back up afterward, preparing for the next interaction.
Figure 2-7 shows the control built by this recipe, which is attached in this case to the bottom of a secondary view. Tugs bring the view into place and return it offscreen when finished.
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.