2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
#import "RCTTouchHandler.h"
|
|
|
|
|
|
|
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
|
|
|
|
|
|
#import "RCTAssert.h"
|
|
|
|
#import "RCTBridge.h"
|
2015-08-11 13:37:12 +00:00
|
|
|
#import "RCTEventDispatcher.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
#import "RCTLog.h"
|
2016-02-03 13:22:17 +00:00
|
|
|
#import "RCTTouchEvent.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
#import "RCTUIManager.h"
|
|
|
|
#import "RCTUtils.h"
|
2015-03-26 09:58:06 +00:00
|
|
|
#import "UIView+React.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
@interface RCTTouchHandler () <UIGestureRecognizerDelegate>
|
|
|
|
@end
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// TODO: this class behaves a lot like a module, and could be implemented as a
|
|
|
|
// module if we were to assume that modules and RootViews had a 1:1 relationship
|
|
|
|
@implementation RCTTouchHandler
|
|
|
|
{
|
2016-02-03 13:22:17 +00:00
|
|
|
__weak RCTEventDispatcher *_eventDispatcher;
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
/**
|
|
|
|
* Arrays managed in parallel tracking native touch object along with the
|
2015-04-27 20:55:01 +00:00
|
|
|
* native view that was touched, and the React touch data dictionary.
|
2015-08-07 23:07:15 +00:00
|
|
|
* These must be kept track of because `UIKit` destroys the touch targets
|
|
|
|
* if touches are canceled, and we have no other way to recover this info.
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
2015-11-03 22:45:46 +00:00
|
|
|
NSMutableOrderedSet<UITouch *> *_nativeTouches;
|
|
|
|
NSMutableArray<NSMutableDictionary *> *_reactTouches;
|
|
|
|
NSMutableArray<UIView *> *_touchViews;
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2016-04-01 13:53:11 +00:00
|
|
|
uint16_t _coalescingKey;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
|
|
{
|
2015-06-15 14:53:45 +00:00
|
|
|
RCTAssertParam(bridge);
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
if ((self = [super initWithTarget:nil action:NULL])) {
|
2016-02-03 13:22:17 +00:00
|
|
|
_eventDispatcher = [bridge moduleForClass:[RCTEventDispatcher class]];
|
2017-01-12 20:06:53 +00:00
|
|
|
|
2015-08-17 14:35:34 +00:00
|
|
|
_nativeTouches = [NSMutableOrderedSet new];
|
|
|
|
_reactTouches = [NSMutableArray new];
|
|
|
|
_touchViews = [NSMutableArray new];
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2017-01-14 01:35:06 +00:00
|
|
|
// `cancelsTouchesInView` and `delaysTouches*` are needed in order to be used as a top level
|
2015-05-05 12:58:07 +00:00
|
|
|
// event delegated recognizer. Otherwise, lower-level components not built
|
|
|
|
// using RCT, will fail to recognize gestures.
|
2015-02-20 04:10:52 +00:00
|
|
|
self.cancelsTouchesInView = NO;
|
2017-01-14 01:35:06 +00:00
|
|
|
self.delaysTouchesBegan = NO; // This is default value.
|
|
|
|
self.delaysTouchesEnded = NO;
|
2017-01-12 20:06:53 +00:00
|
|
|
|
|
|
|
self.delegate = self;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
2017-01-12 20:06:53 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2015-08-24 10:14:33 +00:00
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithTarget:(id)target action:(SEL)action)
|
2015-06-15 14:53:45 +00:00
|
|
|
|
2017-01-09 08:09:38 +00:00
|
|
|
- (void)attachToView:(UIView *)view
|
|
|
|
{
|
|
|
|
RCTAssert(self.view == nil, @"RCTTouchHandler already has attached view.");
|
|
|
|
|
|
|
|
[view addGestureRecognizer:self];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)detachFromView:(UIView *)view
|
|
|
|
{
|
|
|
|
RCTAssertParam(view);
|
|
|
|
RCTAssert(self.view == view, @"RCTTouchHandler attached to another view.");
|
|
|
|
|
|
|
|
[view removeGestureRecognizer:self];
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
#pragma mark - Bookkeeping for touch indices
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)_recordNewTouches:(NSSet<UITouch *> *)touches
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
for (UITouch *touch in touches) {
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
RCTAssert(![_nativeTouches containsObject:touch],
|
|
|
|
@"Touch is already recorded. This is a critical bug.");
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Find closest React-managed touchable view
|
|
|
|
UIView *targetView = touch.view;
|
|
|
|
while (targetView) {
|
2017-04-10 19:27:47 +00:00
|
|
|
if (targetView.reactTag && targetView.userInteractionEnabled) {
|
2015-02-20 04:10:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
targetView = targetView.superview;
|
|
|
|
}
|
2015-02-27 02:08:56 +00:00
|
|
|
|
2015-03-25 00:37:03 +00:00
|
|
|
NSNumber *reactTag = [targetView reactTagAtPoint:[touch locationInView:targetView]];
|
|
|
|
if (!reactTag || !targetView.userInteractionEnabled) {
|
2017-01-04 22:40:32 +00:00
|
|
|
continue;
|
2015-02-27 02:08:56 +00:00
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2015-06-05 03:20:37 +00:00
|
|
|
// Get new, unique touch identifier for the react touch
|
2015-02-20 04:10:52 +00:00
|
|
|
const NSUInteger RCTMaxTouches = 11; // This is the maximum supported by iDevices
|
2015-06-05 03:20:37 +00:00
|
|
|
NSInteger touchID = ([_reactTouches.lastObject[@"identifier"] integerValue] + 1) % RCTMaxTouches;
|
2015-02-20 04:10:52 +00:00
|
|
|
for (NSDictionary *reactTouch in _reactTouches) {
|
2015-06-05 03:20:37 +00:00
|
|
|
NSInteger usedID = [reactTouch[@"identifier"] integerValue];
|
2015-02-20 04:10:52 +00:00
|
|
|
if (usedID == touchID) {
|
|
|
|
// ID has already been used, try next value
|
|
|
|
touchID ++;
|
|
|
|
} else if (usedID > touchID) {
|
|
|
|
// If usedID > touchID, touchID must be unique, so we can stop looking
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Create touch
|
2016-01-27 17:04:14 +00:00
|
|
|
NSMutableDictionary *reactTouch = [[NSMutableDictionary alloc] initWithCapacity:RCTMaxTouches];
|
2015-03-25 00:37:03 +00:00
|
|
|
reactTouch[@"target"] = reactTag;
|
2015-02-20 04:10:52 +00:00
|
|
|
reactTouch[@"identifier"] = @(touchID);
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Add to arrays
|
|
|
|
[_touchViews addObject:targetView];
|
|
|
|
[_nativeTouches addObject:touch];
|
|
|
|
[_reactTouches addObject:reactTouch];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)_recordRemovedTouches:(NSSet<UITouch *> *)touches
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
for (UITouch *touch in touches) {
|
|
|
|
NSUInteger index = [_nativeTouches indexOfObject:touch];
|
2017-01-04 22:40:32 +00:00
|
|
|
if (index == NSNotFound) {
|
2015-02-27 02:08:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
[_touchViews removeObjectAtIndex:index];
|
|
|
|
[_nativeTouches removeObjectAtIndex:index];
|
|
|
|
[_reactTouches removeObjectAtIndex:index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)_updateReactTouchAtIndex:(NSInteger)touchIndex
|
|
|
|
{
|
|
|
|
UITouch *nativeTouch = _nativeTouches[touchIndex];
|
|
|
|
CGPoint windowLocation = [nativeTouch locationInView:nativeTouch.window];
|
|
|
|
CGPoint rootViewLocation = [nativeTouch.window convertPoint:windowLocation toView:self.view];
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
UIView *touchView = _touchViews[touchIndex];
|
|
|
|
CGPoint touchViewLocation = [nativeTouch.window convertPoint:windowLocation toView:touchView];
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
NSMutableDictionary *reactTouch = _reactTouches[touchIndex];
|
|
|
|
reactTouch[@"pageX"] = @(rootViewLocation.x);
|
|
|
|
reactTouch[@"pageY"] = @(rootViewLocation.y);
|
|
|
|
reactTouch[@"locationX"] = @(touchViewLocation.x);
|
|
|
|
reactTouch[@"locationY"] = @(touchViewLocation.y);
|
|
|
|
reactTouch[@"timestamp"] = @(nativeTouch.timestamp * 1000); // in ms, for JS
|
2016-01-27 15:13:14 +00:00
|
|
|
|
2016-01-27 17:04:14 +00:00
|
|
|
// TODO: force for a 'normal' touch is usually 1.0;
|
|
|
|
// should we expose a `normalTouchForce` constant somewhere (which would
|
|
|
|
// have a value of `1.0 / nativeTouch.maximumPossibleForce`)?
|
|
|
|
if (RCTForceTouchAvailable()) {
|
|
|
|
reactTouch[@"force"] = @(RCTZeroIfNaN(nativeTouch.force / nativeTouch.maximumPossibleForce));
|
2016-01-27 15:13:14 +00:00
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs information about touch events to send across the serialized
|
|
|
|
* boundary. This data should be compliant with W3C `Touch` objects. This data
|
|
|
|
* alone isn't sufficient to construct W3C `Event` objects. To construct that,
|
|
|
|
* there must be a simple receiver on the other side of the bridge that
|
|
|
|
* organizes the touch objects into `Event`s.
|
|
|
|
*
|
|
|
|
* We send the data as an array of `Touch`es, the type of action
|
|
|
|
* (start/end/move/cancel) and the indices that represent "changed" `Touch`es
|
|
|
|
* from that array.
|
|
|
|
*/
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)_updateAndDispatchTouches:(NSSet<UITouch *> *)touches
|
2015-05-05 12:58:07 +00:00
|
|
|
eventName:(NSString *)eventName
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
// Update touches
|
2015-11-03 22:45:46 +00:00
|
|
|
NSMutableArray<NSNumber *> *changedIndexes = [NSMutableArray new];
|
2015-02-20 04:10:52 +00:00
|
|
|
for (UITouch *touch in touches) {
|
|
|
|
NSInteger index = [_nativeTouches indexOfObject:touch];
|
2015-02-27 02:08:56 +00:00
|
|
|
if (index == NSNotFound) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
[self _updateReactTouchAtIndex:index];
|
|
|
|
[changedIndexes addObject:@(index)];
|
|
|
|
}
|
2015-02-27 02:08:56 +00:00
|
|
|
|
|
|
|
if (changedIndexes.count == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2015-03-23 20:28:42 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Deep copy the touches because they will be accessed from another thread
|
|
|
|
// TODO: would it be safer to do this in the bridge or executor, rather than trusting caller?
|
2015-11-03 22:45:46 +00:00
|
|
|
NSMutableArray<NSDictionary *> *reactTouches =
|
2017-01-12 20:06:53 +00:00
|
|
|
[[NSMutableArray alloc] initWithCapacity:_reactTouches.count];
|
2015-02-20 04:10:52 +00:00
|
|
|
for (NSDictionary *touch in _reactTouches) {
|
|
|
|
[reactTouches addObject:[touch copy]];
|
|
|
|
}
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
BOOL canBeCoalesced = [eventName isEqualToString:@"touchMove"];
|
|
|
|
|
|
|
|
// We increment `_coalescingKey` twice here just for sure that
|
|
|
|
// this `_coalescingKey` will not be reused by ahother (preceding or following) event
|
|
|
|
// (yes, even if coalescing only happens (and makes sense) on events of the same type).
|
|
|
|
|
|
|
|
if (!canBeCoalesced) {
|
|
|
|
_coalescingKey++;
|
|
|
|
}
|
|
|
|
|
2016-02-03 13:22:17 +00:00
|
|
|
RCTTouchEvent *event = [[RCTTouchEvent alloc] initWithEventName:eventName
|
2016-09-16 23:12:17 +00:00
|
|
|
reactTag:self.view.reactTag
|
2016-02-03 13:22:17 +00:00
|
|
|
reactTouches:reactTouches
|
2016-04-01 13:53:10 +00:00
|
|
|
changedIndexes:changedIndexes
|
2016-04-01 13:53:11 +00:00
|
|
|
coalescingKey:_coalescingKey];
|
2017-01-12 20:06:53 +00:00
|
|
|
|
|
|
|
if (!canBeCoalesced) {
|
|
|
|
_coalescingKey++;
|
|
|
|
}
|
|
|
|
|
2016-02-03 13:22:17 +00:00
|
|
|
[_eventDispatcher sendEvent:event];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Gesture Recognizer Delegate Callbacks
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
static BOOL RCTAllTouchesAreCancelledOrEnded(NSSet<UITouch *> *touches)
|
2015-05-05 12:58:07 +00:00
|
|
|
{
|
|
|
|
for (UITouch *touch in touches) {
|
|
|
|
if (touch.phase == UITouchPhaseBegan ||
|
|
|
|
touch.phase == UITouchPhaseMoved ||
|
|
|
|
touch.phase == UITouchPhaseStationary) {
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
static BOOL RCTAnyTouchesChanged(NSSet<UITouch *> *touches)
|
2015-05-05 12:58:07 +00:00
|
|
|
{
|
|
|
|
for (UITouch *touch in touches) {
|
|
|
|
if (touch.phase == UITouchPhaseBegan ||
|
|
|
|
touch.phase == UITouchPhaseMoved) {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
#pragma mark - `UIResponder`-ish touch-delivery methods
|
2015-08-07 17:46:42 +00:00
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
[super touchesBegan:touches withEvent:event];
|
2015-02-27 12:05:35 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
// "start" has to record new touches *before* extracting the event.
|
2015-02-20 04:10:52 +00:00
|
|
|
// "end"/"cancel" needs to remove the touch *after* extracting the event.
|
|
|
|
[self _recordNewTouches:touches];
|
2017-01-12 20:06:53 +00:00
|
|
|
|
|
|
|
[self _updateAndDispatchTouches:touches eventName:@"touchStart"];
|
|
|
|
|
|
|
|
if (self.state == UIGestureRecognizerStatePossible) {
|
2015-08-07 17:46:42 +00:00
|
|
|
self.state = UIGestureRecognizerStateBegan;
|
2017-01-12 20:06:53 +00:00
|
|
|
} else if (self.state == UIGestureRecognizerStateBegan) {
|
|
|
|
self.state = UIGestureRecognizerStateChanged;
|
2015-08-07 17:46:42 +00:00
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
[super touchesMoved:touches withEvent:event];
|
2015-05-05 12:58:07 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
[self _updateAndDispatchTouches:touches eventName:@"touchMove"];
|
|
|
|
self.state = UIGestureRecognizerStateChanged;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
[super touchesEnded:touches withEvent:event];
|
2015-05-05 12:58:07 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
[self _updateAndDispatchTouches:touches eventName:@"touchEnd"];
|
2015-08-07 17:46:42 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) {
|
|
|
|
self.state = UIGestureRecognizerStateEnded;
|
|
|
|
} else if (RCTAnyTouchesChanged(event.allTouches)) {
|
|
|
|
self.state = UIGestureRecognizerStateChanged;
|
2015-05-05 12:58:07 +00:00
|
|
|
}
|
2017-01-12 20:06:53 +00:00
|
|
|
|
2015-08-07 17:46:42 +00:00
|
|
|
[self _recordRemovedTouches:touches];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-11-03 22:45:46 +00:00
|
|
|
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
[super touchesCancelled:touches withEvent:event];
|
2015-05-05 12:58:07 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
[self _updateAndDispatchTouches:touches eventName:@"touchCancel"];
|
2015-08-07 17:46:42 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) {
|
|
|
|
self.state = UIGestureRecognizerStateCancelled;
|
|
|
|
} else if (RCTAnyTouchesChanged(event.allTouches)) {
|
|
|
|
self.state = UIGestureRecognizerStateChanged;
|
2015-05-05 12:58:07 +00:00
|
|
|
}
|
2017-01-12 20:06:53 +00:00
|
|
|
|
2015-08-07 17:46:42 +00:00
|
|
|
[self _recordRemovedTouches:touches];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 14:53:45 +00:00
|
|
|
- (BOOL)canPreventGestureRecognizer:(__unused UIGestureRecognizer *)preventedGestureRecognizer
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
2017-01-12 20:06:53 +00:00
|
|
|
// We fail in favour of other external gesture recognizers.
|
|
|
|
// iOS will ask `delegate`'s opinion about this gesture recognizer little bit later.
|
|
|
|
return ![preventingGestureRecognizer.view isDescendantOfView:self.view];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-08-07 23:07:15 +00:00
|
|
|
- (void)reset
|
|
|
|
{
|
2017-01-12 20:06:53 +00:00
|
|
|
if (_nativeTouches.count != 0) {
|
|
|
|
[self _updateAndDispatchTouches:_nativeTouches.set eventName:@"touchCancel"];
|
2017-01-04 22:40:32 +00:00
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
[_nativeTouches removeAllObjects];
|
|
|
|
[_reactTouches removeAllObjects];
|
|
|
|
[_touchViews removeAllObjects];
|
|
|
|
}
|
2015-08-07 17:46:42 +00:00
|
|
|
}
|
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
#pragma mark - Other
|
|
|
|
|
2016-01-21 21:43:58 +00:00
|
|
|
- (void)cancel
|
|
|
|
{
|
|
|
|
self.enabled = NO;
|
|
|
|
self.enabled = YES;
|
|
|
|
}
|
|
|
|
|
2017-01-12 20:06:53 +00:00
|
|
|
#pragma mark - UIGestureRecognizerDelegate
|
|
|
|
|
2017-01-13 20:30:29 +00:00
|
|
|
- (BOOL)gestureRecognizer:(__unused UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
2017-01-12 20:06:53 +00:00
|
|
|
{
|
|
|
|
// Same condition for `failure of` as for `be prevented by`.
|
|
|
|
return [self canBePreventedByGestureRecognizer:otherGestureRecognizer];
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@end
|