Skip to content

Commit 6eb90b2

Browse files
committed
Assert recognizers not already added
From iOS9 adding a gesture recognizer that is already associated with a view is an error and no longer associates it with the second view - it leaves it on the first. See http://forum.cocos2d-objc.org/t/onenter-call-order-issue/17718/1 for circumstances in which this can (relatively easily) happen due to user code. Assert prevents the problem and indicates a possible path to look at to fix it.
1 parent 527f906 commit 6eb90b2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cocos2d-ui/CCScrollView.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni
763763

764764
- (void) onEnterTransitionDidFinish
765765
{
766+
NSAssert(_panRecognizer.view == nil && _tapRecognizer.view == nil, @"CCScrollView: Probable double call into onEnterTransitionDidFinish - gesture recognizers are already added");
767+
766768
// Add recognizers to view
767769
UIView* view = [CCDirector sharedDirector].view;
768770

0 commit comments

Comments
 (0)