博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年11月1日

摘要: IOS 多线程 有三种主要方法(1)NSThread(2)NSOperation(3)GCD下面简单介绍这三个方法1.NSThread 调用方法如下: 如函数需要输入参数,可从object传进去。 (1) [NSThread detachNewThreadSelector:@selector(threadInMainMethod:) toTarget:self withObject:nil]; (2) NSThread* myThread = [[NSThread alloc] initWithTarget:self selector:@selector(threadInMain... 阅读全文
posted @ 2011-11-01 23:17 Likwo 阅读(6269) 评论(1) 推荐(6) 编辑

摘要: 解决方法如下dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(Reconnect:) userInfo:nil repeats:NO]; [[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode]; [[NSRun... 阅读全文
posted @ 2011-11-01 14:37 Likwo 阅读(2109) 评论(0) 推荐(0) 编辑