我的班级会失去记忆吗?

时间:2011-05-18 02:37:37

标签: iphone objective-c cocos2d-iphone

我有一个类,下面列出了两种方法。我在函数中从另一个类中调用它们。在这个函数中,我新上课然后调用fireTorpedoContinued。在C#中,一切都会很棒,但我开始思考它。我没有在任何地方保留这个课程,似乎没有任何东西可以阻止它在火炮鱼雷和火器人之间的记忆力继续下去。有什么东西能坚持这个课程还是我需要保留它?例如,execute函数类是否保留了类?如果那不是我会遇到麻烦怎么办?

- (void) fireTorpedoContinued
{
    [self.torpedoData.explosionSprite stopAllActions];
    CCPlace *placeAction = [CCPlace actionWithPosition:_endPoint];
    CCShow *showAction = [CCShow action];
    CCCallFunc *callFunctionDeathCheck = [CCCallFunc actionWithTarget:self.deathCheckSelectorTarget selector:self.deathCheckSelector];
    CCFadeOut *fadeOutAction = [CCFadeOut actionWithDuration:1.0f];
    CCCallFunc *callfunctionAction = [CCCallFunc actionWithTarget:self.completedSelectorTarget selector:self.completedSelector];

    CCSequence *sequenceAction = [CCSequence actions:placeAction, showAction, callFunctionDeathCheck, fadeOutAction, callfunctionAction, nil];
    [self.torpedoData.explosionSprite runAction:sequenceAction];

}

- (void) fireTorpedo
{
    [self.torpedoData.torpedoSprite stopAllActions];
    CCPlace *placeAction = [CCPlace actionWithPosition:_startPoint];
    CCShow *showAction = [CCShow action];
    CCMoveTo *moving = [CCMoveTo actionWithDuration:2.0f position:_endPoint];
    CCHide *hideAction = [CCHide action];    
    CCAction *callCompletedFunction = [CCCallFunc actionWithTarget:self selector:@selector(fireTorpedoContinued)];

    CCSequence *sequenceAction = [CCSequence actions:placeAction, showAction, moving, hideAction, callCompletedFunction, nil];
    [self.torpedoData.torpedoSprite runAction: sequenceAction];
}

1 个答案:

答案 0 :(得分:1)