Testing Touches
Recipe 2-8 limits interactions in two ways. First, the user must touch inside the ribbon art to begin interaction. If the user touches anywhere other than the ribbon, the touch falls through, and the control does not respond to it, even though touches may have begun on top of the control’s frame. Second, the recipe tests against the ribbon bitmap to ensure that touches began on a solid (nontransparent) part of the art. As you can see in Figure 2-7, a notch appears at the bottom of the artwork. Touches in this notch won’t start a tracking sequence. The recipe compares the touch position with pixels in the art. If the transparency (alpha level) of the art falls below 85 (about 67% transparent), the touch won’t connect with the ribbon. ...
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.