iOS8 Wool Glass effect (Uivisualeffectview)

Source: Internet
Author: User

First there are 4 of these classes

Uivisualeffect

Uiblureffect

Uivibrancyeffect

Uivisualeffectview

Inheritance relationship

Uivisualeffect: nsobject

|-> Uiblureffect

|-> Uivibrancyeffect

Uivisualeffectview: UIView

From Baidu translation (this is not easy to learn programming)

Visual

(of visual acuity);

Blur

N. stain, stain, stains;   a vague thing;  Ambiguous

vt.& VI.   to smear or stain;  (to) become blurred (make) difficult to distinguish;

Effec

N. Impact;   Effect   Impression  All things;

Vt.   to make happen;   Cause produce (effect);

Vibrancy

N. vibration;   The sound of vibration;   Active  Dynamic

Initialization

typedef ns_enum (Nsinteger, Uiblureffectstyle) {
uiblureffectstyleextralight,//-Highlighted style
The style of uiblureffectstylelight,//lighting
uiblureffectstyledark//of the Dark style
} ;

Uiblureffect *blur = [uiblureffect effectwithstyle:uiblureffectstyledark];

Uivisualeffectview *vise = [[uivisualeffectview alloc] initwitheffect: Blur];

 然后这样
Uiimageview * view = [[Uiimageview alloc]initwithframe:cgrectmake (0,0, Self.view.frame.size.width, Self.view.frame.size.height)]; UIImage* img = [UIImage imagenamed:@"1.jpg"]; Uivisualeffectview* Effectview =[[Uivisualeffectview Alloc]initwitheffect:[uiblureffect Effectwithstyle:uiblureffectstyleextralight]]; //set the degree of the BlurEffectview.alpha=1.0; Effectview.frame=cgrectmake (0,0, Self.view.frame.size.width, $); View.image=img;    [View Addsubview:effectview]; [Self.view Addsubview:view];

The result is this (there is no text at this time, it will be in the code later)

There is also a style

Note the text, here's how it's initialized

1.

    Uiblureffect *blur = [Uiblureffect Effectwithstyle:uiblureffectstyledark];         *vibrancy = [Uivibrancyeffect Effectforblureffect:blur];         *vise = [[Uivisualeffectview alloc] initwitheffect:vibrancy];

2. You need to add the label to the Contentview

[Vise.contentview Addsubview:lab];

Uiblureffect is the entire background of the virtual, Uivibrancyeffect is added to the label and other attachments to the background of the blur. Note that these attachments must be added to the Uivisualeffectview Contentview, otherwise it will not have any effect.

iOS8 Wool Glass effect (Uivisualeffectview)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.