Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 标签一开始完全显示,而不是像我希望的那样淡入淡出_Iphone_Cocos2d Iphone - Fatal编程技术网

Iphone 标签一开始完全显示,而不是像我希望的那样淡入淡出

Iphone 标签一开始完全显示,而不是像我希望的那样淡入淡出,iphone,cocos2d-iphone,Iphone,Cocos2d Iphone,我正在尝试使一个CCLabelTTF淡入然后淡出 这是我用来做这件事的代码: CCLabelTTF *intro = [CCLabelTTF labelWithString:@"Welcome" fontName:@"Times New Roman" fontSize:30]; [intro setPosition:ccp(240, 110)]; [intro runAction:[CCSequence actions:[CCFadeIn actionWithDuration:2.0f], [C

我正在尝试使一个
CCLabelTTF
淡入然后淡出

这是我用来做这件事的代码:

CCLabelTTF *intro = [CCLabelTTF labelWithString:@"Welcome" fontName:@"Times New Roman" fontSize:30];
[intro setPosition:ccp(240, 110)];
[intro runAction:[CCSequence actions:[CCFadeIn actionWithDuration:2.0f], [CCFadeOut actionWithDuration:2.0f], nil]];
[self addChild:intro];

它可以工作,但是当我运行程序时,
CCLabelTTF intro
会很快完全显示出来(不透明度为1.0f,有点像快速闪烁),然后它会消失并像应该的那样淡入淡出。

为什么不将其不透明度设置为零

[intro setOpacity:0];