title: iOS How to determine what is blocking the UI
body: <p>I'm fairly new to iOS development but I'm starting to grasp some of the more complicated concepts. I currently have an application that implements an AVCam to capture video. The AVCam is created on a separate thread, but uses a view that is in my main xib file. When the camera is done capturing, it calls a complete function in my ViewController class. Within the complete function I call a number of other functions that update the UI as well as a few NSLogs. Everything seems to work fine, I see the logs in the console immediately, but the UI takes another 3 seconds to update. I've tried using instruments to find the offending code, but I can't seem to find it. Is there another way to determine what is blocking by UI?</p>
  
  <p>Here is the code called when the recording is complete;</p>
  
  <pre><code>-(void)movieRecordingCompleted{
         [HUD hide:YES];
          NSLog(@"movieRecordingCompleted");
          [self showModalViewController];
          NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mov"];
          NSLog(@"pathToMovie: %@", pathToMovie);
          pathToTreatedVid = pathToMovie;
          NSLog(@"File Save Called");
          UISaveVideoAtPathToSavedPhotosAlbum(pathToMovie, nil, NULL, NULL);
  }
  </code></pre>
  
  <p>Everything is logged immediately, but the progress HUD and the modal view controller don't trigger for about 2 - 5 seconds, it's very strange.</p>
  
  <p>Here is the before and after state of the threads (when it is frozen vs when it becomes unfrozen).
  <img src="https://i.stack.imgur.com/7fkXg.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/BA6jz.png" alt="enter image description here"></p>