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

Commit

Permalink
Merge pull request #1061 from dinhviethoa/ascontrolnode-touchesended-…
Browse files Browse the repository at this point in the history
…twice

Fixed behavior of ASControlNode when -touchesEnded:withEvent: sometimes firing twice.
  • Loading branch information
appleguy committed Jan 14, 2016
2 parents d56f0b1 + dbe068c commit a0c7b0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AsyncDisplayKit/ASControlNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
if (!self.enabled)
return;

// On iPhone 6s, iOS 9.2 (and maybe other versions) sometimes calls -touchesEnded:withEvent:
// twice on the view for one call to -touchesBegan:withEvent:. On ASControlNode, it used to
// trigger an action twice unintentionally. Now, we ignore that event if we're not in a tracking
// state in order to have a correct behavior.
// It might be related to that issue: http://www.openradar.me/22910171
if (!self.tracking)
return;

NSParameterAssert([touches count] == 1);
UITouch *theTouch = [touches anyObject];
CGPoint touchLocation = [theTouch locationInView:self.view];
Expand Down

0 comments on commit a0c7b0a

Please sign in to comment.