Last active
August 29, 2015 14:06
-
-
Save andyzinsser/d9e819579e7ac017f996 to your computer and use it in GitHub Desktop.
iOS Blur Effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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