XWTimer 1.0.3

XWTimer 1.0.3

qxuewei维护。



XWTimer 1.0.3

  • qxuewei

XWTimer

一个简单的Objective-C GCD定时器。

CocoaPod

pod 'XWTimer'

如何使用?

target-selector

self.timer = [XWTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerMethod) repeats:YES];

- (void)timerMethod
{
    /// do somethings
}

block

__weak typeof(self) weakSelf = self;
self.timer =[XWTimer timerWithTimeInterval:1.0 repeats:YES block:^(XWTimer * _Nonnull timer) {
    __strong typeof(weakSelf) strongSelf = weakSelf;
    /// do somethings
}];

开始

[self.timer fire];

暂停

[self.timer pause];

无效化

[self.timer invalidate];