iOS development--Transparent glass

Source: Internet
Author: User

The main implementation code is as follows:

self.rateinfoview  is a well-defined control property control

Can change the transparency value to change the transparent effect of the glass
//virtual Transaction Rate pop -up window- (void) showrateinfo{Self.rateinfoview=[[UIView alloc]initwithframe:self.windowview.frame]; //Rateinfoview.backgroundcolor = [Uicolor blackcolor];Self.rateInfoView.alpha =0. F;        [Self.view AddSubview:self.rateInfoView]; //create the desired type of frosted glass effectUiblureffect*blureffect =[Uiblureffect Effectwithstyle:uiblureffectstyledark]; //Frosted glass ViewUivisualeffectview*effectview =[[Uivisualeffectview alloc] initwitheffect:blureffect]; //add to a control that will have a frosted glass effectEffectview.frame=Self.windowView.frame;        [Self.rateinfoview Addsubview:effectview]; //set Blur transparencyEffectview.alpha=. 8f; Uiimageview*rateimage = [[Uiimageview alloc]initwithframe:cgrectmake (width*0.1, (height-width*0.8*1.11)/2+ -, width*0.8, width*0.8/1.11)]; Rateimage.image= [UIImage imagenamed:@"Virtual rate pop -up window"];        [Self.rateinfoview Addsubview:rateimage]; UIButton*closeinfo =[UIButton Buttonwithtype:uibuttontypecustom]; Closeinfo.frame= CGRectMake (width*0.9- A- A, (height-width*0.8*1.11)/2+ -+ A, A, A); [Closeinfo setimage:[uiimage imagenamed:@"Cancel"] Forstate:uicontrolstatenormal];    [Closeinfo addtarget:self Action: @selector (Closerate) forcontrolevents:uicontroleventtouchupinside];        [Self.rateinfoview Addsubview:closeinfo]; [UIView animatewithduration:0.2animations:^{Self.rateInfoView.alpha=1.0f;        }]; }- (void) closerate{[Self.rateinfoview Removefromsuperview]; }

:

iOS development--Transparent glass

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.