onTouchMoved not working for iOS

How do you get onTouchMoved to work as drag-and-drop for iOS devices? I’m trying to get it to fire when the user moves their finger on the screen, but it only fires when the user lets their finger up. In Android devices, it works and there’s no problems. I’m using Cocos2d-JS v3.17. I did search for similar messages, but didn’t find anything. Thanks.

could share the working code for Android.

    this.touchListener = cc.eventManager.addListener({
      event: cc.EventListener.TOUCH_ONE_BY_ONE,
      swallowTouches: true,
      onTouchBegan: (touch) => this.onTouchBegan(touch),
      onTouchMoved: (touch) => this.onTouchesMoved(touch),
      onTouchEnded: (touch) => this.onTouchEnded(touch),
    }, this);

This is the same code for both Android and iOS.

1 Like

Try this code.

      onTouchBegan:  this.onTouchBegan.bind(this),
      onTouchMoved:  this.onTouchesMoved.bind(this),
      onTouchEnded:  this.onTouchEnded.bind(this),

onTouchBegan: function(touch, event){
}
1 Like