runloop创建

  1. NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];  
  2.     if (conn) {  
  3.         NSPort* port = [NSPort port];     
  4.         NSRunLoop* rl = [NSRunLoop currentRunLoop]; // Get the runloop  
  5.         [rl addPort:port forMode:NSDefaultRunLoopMode];  
  6.         [conn scheduleInRunLoop:rl forMode:NSDefaultRunLoopMode];  
  7.     }  

  1. while(!isFinished) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; }  

你可能感兴趣的:(runloop创建)