Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit a0c7b0a

Browse files
committed
Merge pull request #1061 from dinhviethoa/ascontrolnode-touchesended-twice
Fixed behavior of ASControlNode when -touchesEnded:withEvent: sometimes firing twice.
2 parents d56f0b1 + dbe068c commit a0c7b0a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

AsyncDisplayKit/ASControlNode.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
170170
if (!self.enabled)
171171
return;
172172

173+
// On iPhone 6s, iOS 9.2 (and maybe other versions) sometimes calls -touchesEnded:withEvent:
174+
// twice on the view for one call to -touchesBegan:withEvent:. On ASControlNode, it used to
175+
// trigger an action twice unintentionally. Now, we ignore that event if we're not in a tracking
176+
// state in order to have a correct behavior.
177+
// It might be related to that issue: http://www.openradar.me/22910171
178+
if (!self.tracking)
179+
return;
180+
173181
NSParameterAssert([touches count] == 1);
174182
UITouch *theTouch = [touches anyObject];
175183
CGPoint touchLocation = [theTouch locationInView:self.view];

0 commit comments

Comments
 (0)