NStimer

tableview 滑动导致 NSTimer和delegate 回调停止 解决办法

// request回调

NSURLRequest *request = ...

NSURLConnection *connection = [[NSURLConnection alloc]
                                               initWithRequest:request
                                                          delegate:self
                                             startImmediately:NO];
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop]
                                            forMode:NSRunLoopCommonModes];
[connection start];


//timer 回调

NSTimer *updateTimer = [NSTimer scheduledTimerWithTimeInterval:0.01f    target:self selector:@selector(updatePencent) userInfo:nil repeats:YES];

NSRunLoop *main=[NSRunLoop currentRunLoop];
[main addTimer:updateTimer forMode:NSRunLoopCommonModes];

原文地址:https://www.cnblogs.com/hl666/p/3800063.html