AsyncDisplayKit

Hit Test Visualization

Visualize ASControlNode Tappable Areas


This debug feature adds a semi-transparent highlight overlay on any ASControlNodes containing a target:action: pair or gesture recognizer. The tappable range is defined as the ASControlNode’s frame + its .hitTestSlop UIEdgeInsets. Hit test slop is a unique feature of ASControlNode that allows it to extend its tappable range.

In the screenshot below, you can quickly see that

screen shot 2016-03-25 at 4 39 23 pm

Restrictions


A green border on the edge(s) of the highlight overlay indicates that that edge of the tapable area is restricted by one of it’s superview’s tapable areas. An orange border on the edge(s) of the highlight overlay indicates that that edge of the tapable area is clipped by .clipsToBounds of a parent in its hierarchy.

Usage


In your AppDelegate.m file,

Make sure to call this method before initializing any ASControlNodes - including ASButtonNodes, ASImageNodes, and ASTextNodes.

Edit on GitHub