Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCControl isTouchEnabled issue #12

Open
JohnSmith01900 opened this issue Jun 7, 2013 · 0 comments
Open

CCControl isTouchEnabled issue #12

JohnSmith01900 opened this issue Jun 7, 2013 · 0 comments

Comments

@JohnSmith01900
Copy link

Hi,

I am having some issues with CCControl. If I call control.isTouchEnabled = NO, then call control.isTouchEnabled = YES again, the control will no longer work.

The reason is because the CCControl's implementation, it actually registers targeted delegates in onEnter and onExit, instead of overriding CCLayer's registerWithTouchDispatcher. The default CCLayer's registerWithTouchDispatcher behavior actually registers a standard delegate, which results the issue I am facing.

The way I solve it is by modifying CCControl. I override the registerWithTouchDispatcher function which registers a targeted delegate. Inside onEnter and onExit, I simply calls self.isTouchEnabled = YES or self.isTouchEnabled = NO (You can wrap that around macro to add self.mouseEnabled too). I also removed the self.isTouchEnabled inside init function too, so touch is only enabled after onEnter.

Thank you for your time for reading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant