第一种:NSThread
NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector(runningTap:) object:nil];
[thread setName:@"窗口2"];
[thread start];//手动启动线程
第二种:NSOperation
NSInvocationOperation *io=[[NSInvocationOperation alloc]initWithTarget:self selector:@selector(operationTap:) object:@"me"];
//[io start];
//操作线程队列 队列中有线程池
NSOperationQueue *queue=[[NSOperationQueue alloc]init];
[queue addOperation:io];
第三种:GCD(提倡)
dispatch_async(dispatch_get_global_queue(0, 0), ^(block));
第四种:
[self performSelectorOnMainThread:@selector() withObject:@"" waitUntilDone:YES];