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

时间:2014-08-11 21:31:22   收藏:0   阅读:393

- (void)startLoop

{

        [NSThread detachNewThreadSelector:@selector(loopMethod) toTarget:self withObject:nil];

}


- (void)loopMethod

{

    [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(toDo) userInfo:nil repeats:YES];

     NSRunLoop *loop = [NSRunLoop currentRunLoop];

    [loop run];

}


- (void)toDo

{

NSLog("去做些事情");

}

ios 独立创建一条线程,去做些事情,布布扣,bubuko.com

原文:http://blog.csdn.net/alincexiaohao/article/details/38497203

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!