下面的示例代码永远不会出现在 while 循环中,并且它总是将正在运行的操作数打印为 1。我错过了什么?
在此先感谢克里希纳
-(id)init
{
if(self == [super init])
{
CCSPrite *mySprt = [CCSprite spriteWithFile:@"myFile.png"];
mySprt.position = ccp(160,240);
mySprt.tag = 331;
CCFadeTo *fadeSprt = [CCFadeTo actionWithDuration:20.0 opacity:0];
[mySprt runAction:fadeSprt];
[self addChild:mySprt];
[self checkActionCount];
}
return self;
}
-(void)checkActionCount
{
while([self getchildByTag:331].numberofrunningactions > 0)
{
NSLog(@"Number of actions = %d",[self getchildByTag:331].numberofrunningactions);
continue;
}
NSLog(@"Number of actions = %d",[self getchildByTag:331].numberofrunningactions);
}