我试图让CCLabelTTF使用字符串数组每10秒更改一次文本。 这是我到目前为止的代码,但它给了我这个错误!
2013-09-07 15:47:34.618 MazeIt[6271:1b503] -[TitleLayer opacity]: unrecognized selector sent to instance 0xa553bb0
如果对runAction和CCLabel更有经验的人可以帮助我,那将非常有帮助!
这是我的代码: 我有_list是字符串数组,_text是CCLabelTTF,我想操纵
In init _text and _list is created:
[self schedule:@selector(callback) interval:10.0f];
-(void) callback
{
id fadeIn = [_text runAction:[CCFadeTo actionWithDuration:0.5 opacity:127]];
id fadeOut = [_text runAction:[CCFadeTo actionWithDuration:0.5 opacity:255]];
id change = [CCCallFunc actionWithTarget:_text selector: @selector(changeText:)];
id sequence = [CCSequence actions: fadeIn, change, fadeOut, nil];
[self runAction: sequence];
}
- (void)changeText:(id)sender{
[_text setString:@"You completed no levels!"];
// [_text setString:_list[0]];
// [_text setString:_list[_next%[_list count]]];
_next++;
}
谢谢!!!
答案 0 :(得分:0)
-(void) callback
{
id fadeIn = [CCFadeTo actionWithDuration:0.5 opacity:0];
id fadeOut = [CCFadeTo actionWithDuration:0.5 opacity:255];
id change = [CCCallFunc actionWithTarget:self selector: @selector(changeText:)];
id sequence = [CCSequence actions: fadeIn, change, fadeOut, nil];
[_text runAction: sequence];
}