【问题标题】:'sharedDispatcher' is deprecated'sharedDispatcher' 已弃用
【发布时间】:2012-12-06 20:53:26
【问题描述】:

我已经添加了这个功能。

- (void) registerWithTouchDispatcher {
    [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}

错误:sharedDispatcher 已弃用

这是什么意思,我该怎么办?

【问题讨论】:

    标签: iphone


    【解决方案1】:

    看看ccDeprecated.h,上面写着要使用:

    [[CCDirector sharedDirector] touchDispatcher]

    【讨论】:

    • 不错!我不知道 ccDeprecated.h 甚至存在。感谢您指出了这一点。希望上面的用户能接受你的回答。
    • 哇。谢谢!我也不知道该文件存在,这很有帮助
    【解决方案2】:

    改变: [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0swallowsTouches:YES];

    到: [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0swallowsTouches:YES];

    【讨论】:

      【解决方案3】:

      您可以通过按“Shift+Command”键并将鼠标悬停在方法上来检查任何 Cocos (CC) 方法背后的 Cocos2D 代码。对任何已弃用的方法执行此操作会将您带到 CCDeprecated.m,这也会为您提供新方法。

      【讨论】:

        猜你喜欢
        • 2014-02-12
        • 1970-01-01
        • 2016-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-04-20
        相关资源
        最近更新 更多