Problem:
How to create a layer this looks like your Notification center's or control center ' s background
Solution:
Using uiimage+imageeffects to Create a blurred Popup Layer
Code Fragments:
//Create the LayerSelf.layer =[Calayer layer];self.layer.frame= CGRectMake ( the, -, the, the); [Self.view.layer AddSublayer:self.layer];//Take the screenshotfloatScale =[UIScreen Mainscreen].scale; Uigraphicsbeginimagecontextwithoptions (self.view.frame.size, YES, scale); [Self.view drawViewHierarchyInRect:self.view.frame afterscreenupdates:no];__block UIImage*image =Uigraphicsgetimagefromcurrentimagecontext (); Uigraphicsendimagecontext ();//Crop the screenshotCgimageref Imageref =Cgimagecreatewithimageinrect (image. Cgimage,cgrectmake (self.layer.frame.origin.x*SCALE,SELF.LAYER.FRAME.ORIGIN.Y*Scale,self.layer.frame.size.width*Scale,self.layer.frame.size.height*scale )); Image=[UIImage imagewithcgimage:imageref];//Apply The effectimage = [Image applyblurwithradius:50.0ftintcolor:[uicolor colorwithred:0Green1Blue0Alpha0.1]saturationdeltafactor:2Maskimage:nil];//assign it to the new layer ' s contentsSelf.layer.contents = (__bridgeID) (image. Cgimage);