gpt4 book ai didi

swift - Cocos2d-Swift : CCProgressNodeTypeBar not found in Swift

转载 作者:行者123 更新时间:2023-11-30 10:16:15 33 4
gpt4 key购买 nike

这是 ObjectiveC 代码:

CCSprite *progress = [CCSprite spriteWithImageNamed:@"progress.png"];
mProgressBar = [CCProgressNode progressWithSprite:progress];
mProgressBar.type = CCProgressNodeTypeBar;

我尝试将其转换为 Swift:

    var progress = CCSprite.spriteWithImageNamed("progress.png") as! CCSprite
mProgressBar = CCProgressNode.progressWithSprite(progress) as CCProgressNode
mProgressBar.type = CCProgressNodeTypeBar

在 Obj.C 版本中没有错误,对于 Swift,它给出了 CCProgressNodeTypeBar 错误。未找到 API。怎么解决?还有其他选择吗?

最佳答案

作为替代解决方案,我们可以使用 CCProgressNodeType.Bar :

mProgressBar.type = CCProgressNodeType.Bar

关于swift - Cocos2d-Swift : CCProgressNodeTypeBar not found in Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29828644/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com