iphone - Is this NSTimer dealloc acceptable or will it produce an unexpected error? -
i duplicating code, refactored this:
-(void) dealloc { [self resettimer]; [super dealloc]; } -(void) resettimer { if( timer != nil ) { [timer invalidate]; } timer = nil; // set other value zero... }
is acceptable call resettimer method in dealloc method? otherwise end writing same 4 lines in resettimer twice.
i did same thing, , worked fine me. (although rely on nil call, it's just:)
-(void) resettimer { [timer invalidate]; timer = nil; }
Comments
Post a Comment