When the user clicks the button, let the entire screen produce frosted glass effect, blurred background, on this basis to display some view, prompting the user operation success!
In iOS development, you can take a screenshot of the entire screen, blur the image with a certain algorithm, display it on a mask, and add the desired UI effect to the mask.
The core code is as follows:
1 /** * Add masks * **/2- (void) addlayer{3 //screenshot and add frosted glass effect4 Uigraphicsbeginimagecontext (Cgsizemake (Kscreenw, kscreenh));5 [Self.view.window.layer Renderincontext:uigraphicsgetcurrentcontext ()];6UIImage *viewimage =Uigraphicsgetimagefromcurrentimagecontext ();7 Uigraphicsendimagecontext ();8UIImage *image = [UIImage blurryimage:viewimage withblurlevel:0.15];9 //added layer of maskTenUIWindow *keywindow =[[UIWindow alloc]initwithframe:[uiscreen mainscreen].bounds]; One [Keywindow Setwindowlevel:uiwindowlevelalert]; A[Keywindow Setbackgroundcolor:[[uicolor Whitecolor] Colorwithalphacomponent:0.8]]; - [Keywindow makekeyandvisible]; -Self.pwdwindow =Keywindow; the - //set the blurred image to show on Uiimageview and add additional controls on UIWindow -Uiimageview *imageview = [[Uiimageview alloc] Initwithframe:cgrectmake (0,0, Kscreenw, kscreenh)]; -Imageview.image =image; +imageview.userinteractionenabled =YES; - [Self.pwdwindow Addsubview:imageview]; + } A /** at * Take screenshots of photos and blur them - * This method can be used as the classification of Uiimageview - **/ -+ (UIImage *) Blurryimage: (UIImage *) Image withblurlevel: (CGFloat) Blur { - //fuzziness, - if((Blur <0.1f) || (Blur >2.0f)) { inBlur =0.5f; - } to + //boxsize must be greater than 0 - intBoxsize = (int) (Blur * -); theBoxsize-= (boxsize%2) +1; *NSLog (@"boxsize:%i", boxsize); $ //image ProcessingPanax NotoginsengCgimageref img =image. Cgimage; - //need to introduce the /* + This document describes the accelerate Framework, which contains C APIs for vector and Matrix math, digital Signa L processing, large number handling, and image processing. A This document describes the accelerate Framework, which contains vector and matrix math for C language Application interfaces (APIs), digital signal processing, mass processing, and image processing. the */ + - //image cache, input cache, output cache $ Vimage_buffer Inbuffer, Outbuffer; $ Vimage_error Error; - //Pixel Cache - void*Pixelbuffer; the //The data source provider, defines an opaque type, the supplies Quartz with data. -Cgdataproviderref Inprovider =Cgimagegetdataprovider (IMG);Wuyi //provider ' s data. theCfdataref Inbitmapdata =Cgdataprovidercopydata (inprovider); - //width, height, byte/line, data WuInbuffer.width =cgimagegetwidth (IMG); -Inbuffer.height =cgimagegetheight (IMG); AboutInbuffer.rowbytes =Cgimagegetbytesperrow (IMG); $Inbuffer.data = (void*) cfdatagetbyteptr (inbitmapdata); - //like number cache, byte line * Picture High -Pixelbuffer = malloc (Cgimagegetbytesperrow (IMG) *cgimagegetheight (IMG)); -Outbuffer.data =Pixelbuffer; AOutbuffer.width =cgimagegetwidth (IMG); +Outbuffer.height =cgimagegetheight (IMG); theOutbuffer.rowbytes =Cgimagegetbytesperrow (IMG); - //Third Intermediate buffer, anti-aliasing effect $ void*pixelbuffer2 = malloc (Cgimagegetbytesperrow (IMG) *cgimagegetheight (IMG)); the Vimage_buffer OutBuffer2; theOutbuffer2.data =PixelBuffer2; theOutbuffer2.width =cgimagegetwidth (IMG); theOutbuffer2.height =cgimagegetheight (IMG); -Outbuffer2.rowbytes =Cgimagegetbytesperrow (IMG); in the //convolves a region of interest within an ARGB8888 source image by an implicit M x N kernel that have the effect of a B Ox filter. theError = vimageboxconvolve_argb8888 (&inbuffer, &outbuffer2, NULL,0,0, Boxsize, Boxsize, NULL, kvimageedgeextend); About //error = vimageboxconvolve_argb8888 (&outbuffer2, &inbuffer, NULL, 0, 0, boxsize, boxsize, NULL, Kvimageedge Extend); theError = vimageboxconvolve_argb8888 (&inbuffer, &outbuffer, NULL,0,0, Boxsize, Boxsize, NULL, kvimageedgeextend); the if(Error) { theNSLog (@"error from convolution%ld", error); + } - //NSLog (@ "byte component:%zu", Cgimagegetbitspercomponent (IMG)); the //Color Space DevicergbBayiCgcolorspaceref ColorSpace =Cgcolorspacecreatedevicergb (); the //create context with picture, Cgimagegetbitspercomponent (IMG), 7,8 theCgcontextref CTX =Cgbitmapcontextcreate ( - Outbuffer.data, - Outbuffer.width, the Outbuffer.height, the 8, the Outbuffer.rowbytes, the ColorSpace, - Cgimagegetbitmapinfo (image. Cgimage)); the //based on context, processed pictures, re-assembly theCgimageref Imageref =cgbitmapcontextcreateimage (CTX); theUIImage *returnimage =[UIImage imagewithcgimage:imageref];94 // Clean Up the cgcontextrelease (CTX); the cgcolorspacerelease (colorspace); the Free (pixelbuffer);98 Free (pixelBuffer2); About cfrelease (inbitmapdata); - cgcolorspacerelease (colorspace);101 cgimagerelease (imageref);102 returnReturnimage;103}
:
IOS Frosted Glass effect