NStimer

时间:2014-06-22 23:51:14   收藏:0   阅读:233

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];

NStimer,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!