When you write the background of the project login page, use the frosted glass, the effect is like this:
So I wrote it out using a system of frosted glass:
Uiblureffect *effect = [Uiblureffect Effectwithstyle:uiblureffectstyledark]; *visualview = [[Uivisualeffectview alloc] initwitheffect:effect]; = [[UIScreen mainscreen] bounds]; [Self.backgroundimageview Addsubview:visualview]; 0.6;
The effect is as follows:
Not the desired effect, and then try again.
Uiblureffectstylelight
Effect:
And then tried the next extralight, also not want the effect, so, I began to look for the internet to customize the glass of the three-side ... Finally, Emperor is not a conscientious.
Address of the three parties: Https://github.com/nicklockwood/FXBlurView
But found inside are English, so ready to translate, for later use.
Fxblurview is a uiview subclass that replaces the iOS 7 real-time background blur effect, but is suitable for iOS 5 or more. It is designed to be faster and easier to use. Fxblurview provides two modes of operation: Static, which is added to the parent view only once when the view is rendered (although it can be updated by calling Setneedsdisplay or updateasynchronously:completion:) or dynamic, It will automatically redraw as soon as possible in a background thread. Support iOS&SDK Version Build goal-support iOS8.4(Xcode8.4, Apple LLVM6. 1 compiler) The earliest deployment targets-IOS7. 0 support for the earliest deployment target--ios4. 3 Compatibility Note: "Support" means that this version of the library has been tested. "Compatible" means that the library should work on this iOS version (that is, it does not rely on any of the SDK features that are not available), but does not perform compatibility testing and may require adjustments or bug fixes to run correctly. Arc compatibility starting with version 1.3, Fxblurview requires arc. If you want to use Fxblurview in a nonWhen-arc a project, simply add the-FOBJC-ARC compiler flag in the FXBLURVIEW.M class. To do this, go to the Build Stage target Settings tab, open Compile Sources, double-click FXBLURVIEW.M, and then add-fobjc-in the pop-up windowarc. If you want your entire project to be converted to arc, comment out the wrong place in the fxblurview.m, and then run the edit> Refactor >convert to objective-C ARC ... Tools in Xcode to make sure that all files (including fxblurview.m) that you want to use arc are checked. Install using Fxblurview, drag the class file to your project and add the accelerate framework. You can create Fxblurview programming instances, or create them in Interface Builder by dragging a normal uiview to your viewfxblurview to view and set its classes. If you are using the Interface Builder (Interface builder), set the custom properties of Fxblurview (those that do not support regular UIView) either create a Iboutlet view and set properties in the code, or in Interface User-defined run-time attribute attributes in the builder (in Xcode4iOS introduced in. 25+). UIImage extended Fxblurview Extended user interface images in the following ways:-(UIImage *) Blurredimagewithradius: (cgfloat) Radius iterations: (Nsuinteger) iterations Tintcolor: (Uicolor*Tintcolor This method applies to the Blur effect and returns the result without modifying the original image. The RADIUS attribute controls the degree of blur effect. Iteration Properties control the number of iterations. More iterations mean high quality. The tintcolor is an optional color that blends the composite image. Note that the transparency setting for Tintcolor is ignored. Fxblurview Method+(void) setblurenabled: (BOOL) blurenabled; This method can be used globally to enable/disables the blur effect for all Fxblurview instances. This is used for testing, or if you want to disable the following blur in iphone 4 and (with iOS7 blur view consistency behavior). Blur is enabled by default. +(void) setupdatesenabled;+(void) setupdatesdisabled; These methods can be used to enable and disable updates for all dynamic Fxblurview instances and one command. Performs an animation immediately before disabling the update so that Fxblurview updates do not cause the animation to stutter. Calls can be nested, but be sure to enable/Disabling the call is balanced, or the update will be permanently enabled or disabled. - (void) updateasynchronously: (BOOL) Async Completion: (void(^) ()) completion; This method can be used to trigger an updated blur effect (useful when dynamic=NO). The Async parameter controls whether the blur is redrawn in the main thread or background. The completion parameter is an optional callback element that will be called when the blur is complete. -(void) Setneedsdisplay; inherited from UIView, this method can be used to trigger an update (synchronization) of a view. Calling this method is more or less equivalent to calling [view Updateasynchronously:no Completion:null]. Fxblurview Property @property (nonatomic, Getter=isblurenabled) BOOL blurenabled; This property switches to individual Fxblurview instances blur. Blurring is enabled by default. Note that if you use the+setblurenabled method Disables blurring that will overwrite the setting. @property (nonatomic, Getter=isdynamic) BOOL dynamic; This property controls whether the Fxblurview is updated dynamically, or only once when the view is added to its parent view. The default value is yes. Note that if dynamic is set to No, you can still force the view to update by calling Setneedsdisplay or updateasynchronously:completion: Done. Dynamic blur is extremely CPU intensive, so you should disable dynamic view immediately before performing an animation to avoid stalling. However, if you have multiple fxblurviews on the screen then simply disable the update using the Setupdatesdisabled method instead of setting the dynamic property. @property (nonatomic, assign) Nsuinteger iterations; the number of fuzzy iterations. More iterations are improved but the quality degrades performance. The default is 2 iterations. @property (nonatomic, assign) Nstimeinterval updateinterval; the time interval (in seconds) between this control is updated continuously when Fxblurview is operating in dynamic mode. This defaults to 0, which means that the Fxblurview will be updated as soon as possible. This yields the best frame rate, but also consumes CPU, which can lead to other performance degradation of the application, especially in older devices. To achieve this, try increasing the value of the updateinterval. @property (nonatomic, assign) CGFloat Blurradius; This property controls the radius (point) of the blur effect. The default is a 40-point radius, which is similar to the iOS 7 blur effect. @property (nonatomic, strong) Uicolor*Tintcolor; This is applied to the Fxblurview in an optional hue color. The RGB components of the color mix blur the image, resulting in a mild color. The intensity effect of different colors, using bright or dark colors. Settings for Tintcolor transparency (Alpha) are ignored. If you do not want to apply color, set this value to zero or (user interface color Clearcolor]. Note that if you are using Xcode 5 above, the default builder created in the Fxblurviews interface will have a blue hue. @property (nonatomic, weak) UIView*Underlyingview; This property specifies the view Fxblurview The example to create a blur effect. If set to 0 (the default), this will be the parent view of the Blur view itself, but you can rewrite it if you need to. FAQs Q: Why do my views all frame on iOS 7th??A. Fxblurview uses the "UIView" "Tintcolor" property, which does not exist in iOS 6 and below, but is blue by default on iOS 7th. Just set this property to'(user interface color Clearcolor] "disables color. Keeping iOS 6 compatible, you can set up the ability to use code, or by using the user-defined runtime property interface Builder, which overrides the standard "Tintcolor" value (see Sample project nib How to do this). Q: Fxblurview makes my entire application run slowly (old device), what can I do?A : To improve performance, try adding the "UpdatePeriod" attribute, reducing the "iteration" property or disabling "dynamic" unless you really need it. If everything fails, "blurenabled" is not set on the old device. Q: My Spritekit/OpenGL/video/3D conversion content is displayed incorrectly when placed in a fxblurview, why not?A: This is a restricted "Calayer" "Renderincontext:" Method used to get the contents of the view. There is no solution in iOS 6 and earlier. On iOS 7th you can use the "UIView" "Drawviewhierarchyinrect:afterscreenupdates:" method to capture a view and apply a blur effect, but it's too slow to use in real time, So Fxblurview does not use this method by default. Q: Fxblurview is not capturing some normal view content, why not??A : Fxblurview captures the contents of its immediate parent view by default. If the parent view is transparent or partially transparent, the content behind it shows that it will not be captured. You can override the "Underlyingview" property to capture the content if you need a different view. Release Notes1.6. 4 version Blurredimagewithradius: iteration: Tintcolor: Now if the image is not ARGB format fixed ": Cgcontextrestoregstate: Invalid context 0 x0. "The empty child layer is hiding the snapshot to prevent Renderincontext from crashing before the iOS8Fxblurview now needs to automatically use the slow Drawviewhierarchyinrect method to capture the content added by the Tesla integration1.6. 3 version Fxblurview image background is no longer transparent/Black, so it can be used as a translucent overlay Underlyingview property is now Iboutlet, so it can be connected to interface builder imported into the head quickly for better compatibility
The specific code used is as follows:
- (void) viewdidload {[Super viewdidload]; Uiimageview* ImageView =[[Uiimageview alloc] initWithFrame:self.view.bounds]; Imageview.image= [UIImage imagenamed:@"default-port-hd47"]; [Self.view Addsubview:imageview]; Fxblurview* Aview = [[Fxblurview alloc] Initwithframe:cgrectmake (0,0, -, -)]; Aview.tintcolor= [Uicolor Whitecolor];//Foreground colorAview.blurradius=20.0;//Blur radiusaview.dynamic= YES;//change the blur effect dynamically[Self.view Addsubview:aview]; Fxblurview* bview = [[Fxblurview alloc] Initwithframe:cgrectmake (0, -, -, -)]; Bview.tintcolor= [Uicolor Whitecolor];//Foreground colorbview.blurenabled= YES;//allow Blur, default YesBview.blurradius=10.0;//Blur radiusbview.dynamic= YES;//change the blur effect dynamicallybview.iterations=2;//Number of iterations:Bview.updateinterval=2.0;//update time (unsure of specific features) /*Blurradius = 1.0 && dynamic = 100 effect and Blurradius = 10.0 && dynamic = 1 effect is approximately the same*/[Self.view Addsubview:bview]; Fxblurview* CView = [[Fxblurview alloc] Initwithframe:cgrectmake ( Max,0, $, $)]; Cview.blurradius=20.0; Cview.tintcolor=[Uicolor Whitecolor]; [Self.view Addsubview:cview];}
The effect is as follows:
An essay on customizing frosted Glass (translation of three-party use)