XBTimer 0.0.6

XBTimer 0.0.6

‘_QianYe’ 维护。



XBTimer 0.0.6

  • 作者
  • 谢贤彬

XBTimer

这是一个会自动销毁的定时器,如果所有者销毁了,或者定时器调用 stop 并且没有强引用定时器时,定时器会自动销毁

使用:


__weak TestViewController *weakSelf = self;
[XBTimer timerStartWithTimeInterval:1 owner:self repeats:YES onMainThread:YES delay:NO block:^(XBTimer *timer) {
    __strong TestViewController *strongSelf = weakSelf;
    if (strongSelf->_count == 4)
    {
        [timer stop];
    }
    NSLog(@"runTimerOnMainRunLoop");
    strongSelf->_count++;
}];