@interface WZKTimerTestVC ()
@property (strong ,nonatomic) NSTimer *timer;
@end
@implementation WZKTimerTestVC
- (void)viewDidDisappear:(BOOL)animated{
? ? [superviewDidDisappear:animated];
? //一定要手動(dòng)關(guān)閉觉义。
? ? [self.timer invalidate];
? ? self.timer=nil;
}
///創(chuàng)建Timer定時(shí)器
- (void)creatTimer {
? ? [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}
///倒計(jì)時(shí)執(zhí)行函數(shù)
- (void)timerForOverTimeOrder {
}
///getting
- (NSTimer*)timer{
? ? if(_timer==nil) {
? ? ? ? _timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerForOverTimeOrder) userInfo:nil repeats:YES];
? ? }
? ? return_timer;
}
@end
相關(guān)文章