ASTextNode shouldn't create a long press gesture recognizer unless the delegate cares about the callback.

This commit is contained in:
Scott Goodson
2015-12-16 17:20:08 -08:00
parent 0cc229d38d
commit f44c829564
2 changed files with 8 additions and 2 deletions

View File

@@ -211,8 +211,9 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
{
[super didLoad];
// If we are view-backed, support gesture interaction.
if (!self.isLayerBacked) {
// If we are view-backed and the delegate cares, support the long-press callback.
SEL longPressCallback = @selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:);
if (!self.isLayerBacked && [self.delegate respondsToSelector:longPressCallback]) {
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_handleLongPress:)];
_longPressGestureRecognizer.cancelsTouchesInView = self.longPressCancelsTouches;
_longPressGestureRecognizer.delegate = self;