2010-12-31 6 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

흠 사본 붙여 넣기 – confusedMind

답변

0

오브젝트의 보유 수가 0이 될 때 (릴리스 호출 중) Objective c 런타임이 호출합니다. dealloc에서 소유 한 오브젝트를 해제 할 수 있습니다.

+0

"객체의 보유 횟수가 0이 될 때"또는 0으로 만드는 방법 – confusedMind

+0

여기에서 IOS의 메모리 관리에 대해 읽어야합니다. http://developer.apple.com/library/ios/ # documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html –

0

할당 된 메모리가 해제 된 것으로 보입니다. 아니요, 자동으로 실행되는 것은 아닙니다. 주석 코드로 판단하십시오.

+0

내장 된 함수 의식이 아니십니까? – confusedMind

+0

내장되어 있지 않은 것처럼 보일 것입니다. 그렇습니다. – DMags

관련 문제