Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This should work. I commented in the code to help you understand what's going on:</p> <pre><code>//To take advantage of CIFilters, you have to import the Core Image framework #import &lt;CoreImage/CoreImage.h&gt; //Get a UIImage from the UIView UIGraphicsBeginImageContext(myView.bounds.size); [myView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //Blur the UIImage with a CIFilter CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage]; CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"]; [gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"]; [gaussianBlurFilter setValue:[NSNumber numberWithFloat: 10] forKey: @"inputRadius"]; CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"]; UIImage *endImage = [[UIImage alloc] initWithCIImage:resultImage]; //Place the UIImage in a UIImageView UIImageView *newView = [[UIImageView alloc] initWithFrame:self.view.bounds]; newView.image = endImage; [self.view addSubview:newView]; </code></pre> <p>If you have any questions about the code, just leave it in the comments.</p> <p><strong>Note:</strong> CIGaussianBlur isn't present on iOS as of 5.1, so you must find a different way to blur the view for devices 5.x+ (Thanks to @BradLarson for this tip). The accepted answer in <a href="https://stackoverflow.com/questions/16182788/how-to-get-the-gaussian-blur-effect-on-a-uiview-in-ios6">this question</a> looks promising as a replacement, as does <a href="https://github.com/alexdrone/ios-realtimeblur" rel="nofollow noreferrer">this library</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload