You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: