NSTimer disables dealloc in UIView

后端 未结 3 1993
日久生厌
日久生厌 2021-02-06 02:56
@interface someview:UIView{
  NSTimer* timer;
}
@end

@implementation someview

-(void)dealloc{
  NSLog(@\"dealloc someview\");
  [timer invalidate];
  timer = nil;
}
-(         


        
3条回答
  •  失恋的感觉
    2021-02-06 03:09

    NSTimer retains the target. Therefore, the timer must be invalidated before your view is dealloc'd.

提交回复
热议问题