title: Blur screen with iOS 7's snapshot API
body: <p>I believe the NDA is down, so I can ask this question. I have a UIView subclass:</p>
  
  <pre><code>BlurView *blurredView = ((BlurView *)[self.view snapshotViewAfterScreenUpdates:NO]);
  blurredView.frame = self.view.frame;
  [self.view addSubview:blurredView];
  </code></pre>
  
  <p>It does its job so far in capturing the screen, but now I want to blur that view. How exactly do I go about this? From what I've read I need to capture the current contents of the view (context?!) and convert it to CIImage (no?) and then apply a CIGaussianBlur to it and draw it back on the view.</p>
  
  <p>How exactly do I do that?</p>
  
  <p>P.S. The view is not animated, so it should be OK performance wise.</p>
  
  <p>EDIT: Here is what I have so far. The problem is that I can't capture the snapshot to a UIImage, I get a black screen. But if I add the view as a subview directly, I can see the snapshot is there.</p>
  
  <pre><code>// Snapshot
  UIView *view = [self.view snapshotViewAfterScreenUpdates:NO];
  
  // Convert to UIImage
  UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
  [view.layer renderInContext:UIGraphicsGetCurrentContext()];
  UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  
  // Apply the UIImage to a UIImageView
  BlurView *blurredView = [[BlurView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
  [self.view addSubview:blurredView];
  blurredView.imageView.image = img;
  
  // Black screen -.-
  </code></pre>
  
  <p>BlurView.m:</p>
  
  <pre><code>- (id)initWithFrame:(CGRect)frame {
      self = [super initWithFrame:frame];
  
      if (self) {
          // Initialization code
          self.imageView = [[UIImageView alloc] init];
          self.imageView.frame = CGRectMake(20, 20, 200, 200);
          [self addSubview:self.imageView];
      }
      return self;
  }
  </code></pre>