NSThread *thread = [[NSThread alloc]initWithBlock:^{
NSTimer *timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timeAction) userInfo:nil repeats:YES];
//UITrackingRunLoopMode (优先切换)UI事件rounloop模式
//NSDefaultRunLoopMode 默认模式 只要有事件处理(放在子线程时默认使用该模式 UI操作不会影响子线程的Runloop)
//NSRunLoopCommonModes 占位符 (兼容 默认、 Tracking)
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
// [[NSRunLoop currentRunLoop] run];//使Runloop循环(死循环)//(不会再执行下面的代码)(这样做线程无法被销毁)
while (finish) {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];//设置循环条件不要死循环
}
// Do any additional setup after loading the view, typically from a nib.
}];
[thread start];