美文网首页
CADsiplayLink NStimer

CADsiplayLink NStimer

作者: 开发界小学生 | 来源:发表于2018-09-11 17:01 被阅读0次

容易循环引用。对target产生强引用。

NStimer解决循环引用问题

1.用block
2.利用消息转发

self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:[Proxy proxtWith:self] selector:@selector(timerTest) userInfo:nil repeats:YES];

+ (instancetype)proxtWith:(id)target
{
    Proxy * x = [[Proxy alloc] init];
    x.target = target;
    return x;
}
- (id)forwardingTargetForSelector:(SEL)aSelector
{
    return self.target;
}

相关文章

  • CADsiplayLink NStimer

    容易循环引用。对target产生强引用。 NStimer解决循环引用问题 1.用block2.利用消息转发

  • iOS中的计时器

    一、NSTimer 创建方法 1 NSTimer *timer = [NSTimer scheduledTimer...

  • NSTimer

    创建NSTimer 创建NSTimer的常用方法是: + (NSTimer *)scheduledTimerWit...

  • iOS 延时

    1 NSTimer //1秒后执行 NSTimer *timer = [NSTimer timerWithTim...

  • iOS 获取网络流量

    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:...

  • 时间倒计时

    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:...

  • 1.4NSTimer

    NSTimer NSTimer.png

  • NSRunloop跟NSTimer

    NSTimer * timer = [NSTimer scheduledTimerWithTimeInterval...

  • iOS-NSTimer 使用

    1.NSTimer的创建方法 2. NStimer的开启 3. NStimer的停止 4. NStimer的其他属...

  • 定时器操作NSTimer

    NSTimer * timer;timer = [NSTimer scheduledTimerWithTimeIn...

网友评论

      本文标题:CADsiplayLink NStimer

      本文链接:https://www.haomeiwen.com/subject/luqugftx.html