title: UI didn't update because of NSOperationQueue waitUntilFinished YES
body: <p>I got an issue. The scenario is like this: I got an NSOperationQueue that contain various NSOperationQueue that need to waitUntilDone:YES. And I need to update the UI too as the queue or the operation is running. What is the best way to handle this situation?</p>
  
  <p>I have tried performSelectorOnMainThread, but is it necessary to use this method every time I need to update the UI. It is seems not a good solution.  </p>
  
  <pre><code>- (void)loadPreviewPageWithMagazineID:(NSString *)magazineID userID:(NSString *)userID {
  NSMutableArray *operationArray = [NSMutableArray array];
  for (NSInteger i = 1; i &lt;= _numTotalPages; ++i) {
      //NSLog(@"currenpage = %d, index = %d",_selectedPage,pageIndex);
      NSDictionary *arguments = [NSDictionary dictionaryWithObjectsAndKeys:magazineID, 
                                 @"itemID", userID, @"userID", [NSNumber numberWithInt:i],
                                 @"pageNumber", nil];
      AFOperation *imageOperation = 
          [[AFOperation alloc] initWithTarget:self 
                                     selector:@selector(savePageToDisk:) 
                                       object:arguments];
      [imageOperation addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
      [imageOperation setUserInfo:arguments];
      [operationArray addObject:imageOperation];
      [imageOperation release];
  }
  [_imageQueue addOperations:operationArray waitUntilFinished:YES];
  }
  
  
  - (void)processingMagazine:(NSDictionary *)arguments {
  // load pdf document from decrypted data 
  NSString *userID = [arguments objectForKey:@"userID"];
  NSString *magazineID = [arguments objectForKey:@"itemID"];
  
  [self loadPreviewPageWithMagazineID:magazineID userID:userID];
  }
  </code></pre>
  
  <p>So each time to update UI I need to call</p>
  
  <pre><code>[_collectionCoverView performSelectorOnMainThread:@selector(setDownloadProgress:)
                                         withObject:[NSNumber numberWithFloat:progress] 
                                      waitUntilDone:YES];
  
  Is there any appropriate way to handle the UI?
  </code></pre>