title: Preview last captured image from AVCaptureStillImageOutput
body: <p>I want to use AVCaptureSession to capture images within my iOS App.
  Based on the code from Apple's sample for AVCam <a href="https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html" rel="nofollow">https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html</a> I tried to show a preview ImageView every time an image is captured. </p>
  
  <pre><code>// Capture a still image.
      [[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
  
          if (imageDataSampleBuffer)
          {
              NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
              [self processImage:[UIImage imageWithData:imageData]];
          }
      }];
  </code></pre>
  
  <p>After capturing processImage is called</p>
  
  <pre><code>- (void) processImage:(UIImage *)image
  {
      [[self postButton] setEnabled:YES];
      [[self postButton] setHidden:NO];
      [[self cancelButton] setEnabled:YES];
      [[self cancelButton] setHidden:NO];
  
      _preview = [[UIImageView alloc] init];
      [_preview setImage:image];
  
      _preview.hidden = NO;
  }
  </code></pre>
  
  <p>But the ImageView is still unchanged/empty when it is displayed. </p>
  
  <p>Can someone help me along?</p>