NSTime 写在-(void)dealloc不被释放
-(void)createTime
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(onTimerCount) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}
-(void)dealloc
{
if (self.timer) {
[self.timer invalidate];
self.timer = nil;
}
}
直接按照上面方式释放是无效的
可以在\ -(void)viewWillDisappear:(BOOL)animated
里面释放