首页 > 代码库 > ios 独立创建一条线程,去做些事情

ios 独立创建一条线程,去做些事情

- (void)startLoop

{

        [NSThreaddetachNewThreadSelector:@selector(loopMethod)toTarget:selfwithObject:nil];

}


- (void)loopMethod

{

    [NSTimerscheduledTimerWithTimeInterval:3.0ftarget:selfselector:@selector(toDo)userInfo:nilrepeats:YES];

     NSRunLoop *loop = [NSRunLoopcurrentRunLoop];

    [loop run];

}


- (void)toDo

{

NSLog("去做些事情");

}