@interface WZKTimerTestVC ()
@property (strong ,nonatomic) NSTimer *timer;
@end
@implementation WZKTimerTestVC
- (void)viewDidDisappear:(BOOL)animated{
[superviewDidDisappear:animated];
[self.timer invalidate];
self.timer=nil;
}
///创建Timer定时器
- (void)creatTimer {
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}
///倒计时执行函数
- (void)timerForOverTimeOrder {
}
///getting
- (NSTimer*)timer{
if(_timer==nil) {
WeakSelf;
_timer = [NSTimer timerWithTimeInterval:1 target:weakSelf selector:@selector(timerForOverTimeOrder) userInfo:nil repeats:YES];
}
return_timer;
}
@end
网友评论