【问题标题】:ccTouchesBegan not calledccTouchesBegan 未调用
【发布时间】:2012-12-07 02:51:37
【问题描述】:

我正在尝试在我的 GameScene 中实现 ccTouchesBegan。

我设置了isTouchEnabled = YES。我也在touchDispatcher 上打电话给addStandardDelegate。最后,在我的AppDelegate 中有[glView setMultipleTouchEnabled:YES]。

但是,从未调用 ccTouchesBegan。

我做错了什么?

【问题讨论】:

    标签: ios objective-c cocos2d-iphone touches


    【解决方案1】:

    解决了!

    我在前一层上注册了触摸,但该层没有被解除分配,因为您必须使用 onExit 方法“取消注册”。

    长话短说:touchesBegan 没有在我的 GameLayer 上被调用,因为它被另一层吞噬了。

    【讨论】:

      【解决方案2】:

      创建一个虚拟应用程序并尝试以下操作:

      @protocol CCStandardTouchDelegate <NSObject>
      @optional
      - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
      - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
      - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
      - (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
      @end
      

      也许对你有帮助..

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-01
        相关资源
        最近更新 更多