Skip to content

Instantly share code, notes, and snippets.

@andyzinsser
Last active August 29, 2015 14:06
Show Gist options
  • Save andyzinsser/d9e819579e7ac017f996 to your computer and use it in GitHub Desktop.
Save andyzinsser/d9e819579e7ac017f996 to your computer and use it in GitHub Desktop.
iOS Blur Effect
#import "UIImage+ImageEffects.h"
// Take a snapshot of whatever view you want to blur
UIImage *image;
UIGraphicsBeginImageContext(myView.bounds.size);
[myView drawViewHierarchyInRect:myView.bounds afterScreenUpdates:true];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// Then set the background of whatever other view to be the blurry version of the snapshot
myBlurryView.backgroundColor = [UIColor colorWithPatternImage:[image applyDarkEffect]];
// also available: applyLightEffect, applyExtraLightEffect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment