iOS clicks Create ripple Effect

Source: Internet
Author: User

iOS Click to create ripple effect by Wusheying
-(void) viewdidload{[Super Viewdidload];    Rippleview = [[UIView alloc] initWithFrame: (cgrect) {0,0,300,300}];    Rippleview.backgroundcolor = [[Uicolor blackcolor] colorwithalphacomponent:0.3];    RippleView.layer.cornerRadius = 150;    Rippleview.layer.maskstobounds=true; rippleview.alpha=0;}    -(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{[super Touchesbegan:touches withevent:event];    Uitouch *touch = [touches anyobject];    Cgpoint location = [Touch LocationInView:self.view];    [Self.view Addsubview:rippleview];    Rippleview.center = location;    Rippleview.transform = Cgaffinetransformmakescale (0.5, 0.5);                         [UIView animatewithduration:0.1 animations:^{rippleview.alpha=1;                     self.view.alpha=0.3;    }]; [UIView animatewithduration:0.7 delay:0 Options:uiviewanimationoptioncurve  Easeinout animations:^{                       Rippleview.transform = Cgaffinetransformmakescale (a);                         rippleview.alpha=0;                     Self.view.alpha=1;                     } completion:^ (BOOL finished) {[Rippleview Removefromsuperview]; }];}


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.