0
我需要在标签淡出后更改标签“chainsLabel”的文本。但是,看来我不能这样做,因为showChainNumber是一个类方法。那么我怎样才能避免这个问题呢?Cocos2d:如何在CCSequence中执行选择器(更改标签)
感谢您的任何建议!
代码如下:
+ (void)showChainNumber{
id action = [CCFadeOut actionWithDuration:0.5f]; // fading out
id change = [CCCallFunc actionWithTarget:self selector: @selector(changeText:)];
[chainsLabel runAction:[CCSequence actions:action,change, nil]];
}
- (void)changeText:(id)sender{
[chainsLabel setString:@""];
}
cocos2d的哪个版本? – Kreiri
为什么是类方法?它可能不应该。你也忽略了提到实际问题是什么(“看起来我不能”不是问题描述 - 为什么你觉得这样?你会得到任何编译器警告/错误或运行时问题吗?)。 – LearnCocos2D
我设置它是一个类方法,因为我需要在ContactListener中调用此方法。我确实得到错误,程序刚刚崩溃。 – alanlzl