2010-12-31 1 views
0
- (void) dealloc 
{ 
    // in case you have something to dealloc, do it in this method 
    // in this particular example nothing needs to be released. 
    // cocos2d will automatically release all the children (Label) 
    [_targets release]; 
    [_projectiles release]; 
    [_nottargets release]; 
    [_helicopters release]; 
    [_Explosions release]; 
    [_GameChances release]; 

    _targets=nil; 
    _projectiles = nil; 
    _nottargets=nil; 
    _helicopters=nil; 
    _Explosions=nil; 
    _GameChances=nil; 

    [super dealloc]; 
} 

私はこの機能を使用していますが、それは何のために使用されていますか?自動的にそれを呼び出すか、別のページに切り替えるときに最後に呼び出す必要がありますか?delloc関数は、それ自体が動作するために使用されるものですか?

+0

理解していないと、まさにこの機能を持っていますか? –

+0

hmmmコピーペースト – confusedMind

答えて

0

オブジェクトの保持カウントがゼロになると(リリースコール中に)Objective cランタイムによって呼び出されます。 deallocで所有しているオブジェクトを解放することができます。

+0

「オブジェクトの保持カウントがゼロになる」とはどういう意味ですか?またはゼロにする方法 – confusedMind

+0

IOSのメモリ管理については、http://developer.apple.com/library/ios/を参照してください。 #documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html –

0

割り当てられたメモリを解放するように見えます。いいえ、自動的に実行されるわけではありませんが、コメントしたコードで判断してください。

+0

組み込み関数儀式ではありませんか? – confusedMind

+0

組み込みではないようですが、そうです。 – DMags

関連する問題