Adds property for long press touch cancellation

This commit is contained in:
Michael Kuntscher 2015-04-01 16:38:29 -07:00
parent 6ae17e55bc
commit a92dd3189b
2 changed files with 7 additions and 1 deletions

View File

@ -187,6 +187,12 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
*/
@property (nonatomic, weak) id<ASTextNodeDelegate> delegate;
/**
@abstract If YES and a long press is recognized, touches are cancelled. Default is NO
*/
@property (nonatomic, assign) BOOL longPressCancelsTouches;
@end
/**

View File

@ -240,7 +240,7 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f)
// If we are view-backed, support gesture interaction.
if (!self.isLayerBacked) {
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_handleLongPress:)];
_longPressGestureRecognizer.cancelsTouchesInView = NO;
_longPressGestureRecognizer.cancelsTouchesInView = self.longPressCancelsTouches;
_longPressGestureRecognizer.delegate = self;
[self.view addGestureRecognizer:_longPressGestureRecognizer];
}