Under UIView animation

Source: Internet
Author: User

#import "ViewController.h" @interface Viewcontroller () {UIButton *btn;}    @end @implementation viewcontroller-(void) viewdidload {[Super viewdidload];    Btn=[uibutton Buttonwithtype:uibuttontypesystem];    Btn.frame=cgrectmake (30, 30, 50, 50);    Btn.backgroundcolor=[uicolor Redcolor];    [Btn settitle:@ "button" forstate:uicontrolstatenormal];    [Btn addtarget:self Action: @selector (Btnclick:) forcontrolevents:uicontroleventtouchupinside];    [Self.view ADDSUBVIEW:BTN]; }//uiviewanimationwithblocks-(void) Btnclick: (ID) sender{//This method parameter 1: Animation duration parameter 2: Modified View Property [UIView Animatewithduration:2    animations:^{Btn.backgroundcolor=[uicolor Blackcolor];           }]; This method parameter 1: Animation time length parameter 2: Modified view property Parameter 3: Animation complete callback [UIView Animatewithduration:3 animations:^{Btn.backgroundcolor=[uicolor   Redcolor];   } completion:^ (BOOL finished) {NSLog (@ "Completion1");   }];        /* Uiviewanimationoptionlayoutsubviews//Submit animation when the layout child controls, indicating that the child controls will be animated with the parent control. UiviewanimationoptionallowuserinteractioN//Animation allows users to communicate, such as touch uiviewanimationoptionbeginfromcurrentstate//start from the current state animation uiviewanimationoptionrepeat//Animation Unlimited Repeat Uiviewanimationoptionautoreverse//Execute animation loop, if set animation infinite repetition uiviewanimationoptionoverrideinheritedduration//Ignore Outer animation nesting Execution time Uiviewanimationoptionoverrideinheritedcurve//ignores the temporal variation curve of the outer animation nesting uiviewanimationoptionallowanimated        Content//animate by changing properties and redrawing if key does not commit the animation will use the snapshot uiviewanimationoptionshowhidetransitionviews//To replace the animated effect of adding the removed layer in an explicit manner Uiviewanimationoptionoverrideinheritedoptions//Ignore options for nested inheritance//Time function curve related uiviewanimationoptioncurveeaseinout/ /Time curve function, from slow to fast uiviewanimationoptioncurveeasein//Time curve function, from slow to very fast uiviewanimationoptioncurveeaseout//Time curve function, from fast to        Slow Uiviewanimationoptioncurvelinear//time curve function, constant speed//Transition animation related Uiviewanimationoptiontransitionnone//no transition animation        Uiviewanimationoptiontransitionflipfromleft//Transitions from left flip uiviewanimationoptiontransitionflipfromright//transitions from right to flip UiviewanimationoptIontransitioncurlup//Roll up Transitions uiviewanimationoptiontransitioncurldown//down volume transitions Uiviewanimationoptiontransitioncro Ssdissolve//Transitions Cross disappear uiviewanimationoptiontransitionflipfromtop//transitions from top to upside uiviewanimationoptiontransitionflipf Rombottom//transition from bottom to///parameter 1 animation time length parameter 2 delay Time parameter 3 enumeration see above comment parameter 4 change View property parameter 5 callback when animation is complete [UIView Animatekeyframeswithdurati On:2 delay:2 options:uiviewkeyframeanimationoptionbeginfromcurrentstate animations:^{Btn.backgroundColor=[UIColo            R Greencolor];            CGRect Frame=btn.frame;            if (frame.origin.x<self.view.frame.size.width-20) {frame.origin.x+=20;                            } else {frame.origin.x=0;    } btn.frame=frame;    } completion:^ (BOOL finished) {NSLog (@ "Completion2");    }]; Transition animation [UIView transitionFromView:self.view toview:btn Duration:5 Options:uiviewanimationoptiontransitioncurldown        completion:^ (BOOL finished) {NSLog (@ "Completion3");   }]; [UIView transitionWithView:self.view Duration:5 Options:uiviewanimationoptiontransitionflipfrombottom animations:^   {Btn.backgroundcolor=[uicolor Redcolor];   } completion:^ (BOOL finished) {NSLog (@ "Completion4");  }];    }-(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} @end

Under UIView animation

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.