title: Dispatch_async and UI
body: <p>I made alert informing user about saving action, i add it to view, save some image and dismiss alert. However it's not working in the way i hoped it would. Looking at code below ofc firstly in console i get "saved.." then "dispath". I would like to get opposite effect firstly get "dispath" then "saved.." (so write alert on screen, then save in background and finally dismiss alert). But i change image of imageView1, so i cant move merging out of dispath_async because its an UI action.. how to do it then..? I need to firstly merge images and after it to save them and all of this calculating time to keep alert in front.</p>
  
  <pre><code>//adding alert to view
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), 
  ^{
      dispatch_async(dispatch_get_main_queue(), ^{
          //i want this to complete-&gt;
          imageView1.image = [self merge:imageView1.image and:imageView2.image];
          NSLog(@"dispatch");
      });
  
      //and then to do this action-&gt;
      UIImageWriteToSavedPhotosAlbum(imageView1.image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
      NSLog(@"saved..");
  
      dispatch_async(dispatch_get_main_queue(), ^{
          [alert dismissWithClickedButtonIndex:0 animated:YES];
      });
  });
  </code></pre>