2011-05-18 52 views
1

我有一個類,下面列出了兩種方法。我在一個函數中從另一個類中調用它們。在這個函數中,我新增了我的類,然後調用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]; 
} 
+3

真的不能回答你,你張貼的實例,並使用這個代碼接收機類的類的內容與它是否被保留無關。 – 2011-05-18 02:41:09

+3

好主人!你有沒有將魚雷發射器連接到你的iPhone? :D Rob非常正確 - 這是向我們展示的錯誤代碼。請張貼使用該類的代碼,而不是類本身。 – 2011-05-18 02:55:17

+1

我期待着下載你的iTorpedo:P – Lukman 2011-05-18 04:48:20

回答