iOS Development Summary (A0)-UIView Animation

Source: Internet
Author: User

Using UIView's several animation aspects can make the animation more simple

1. If the view properties changes, use the following methods

+ (void) Animatewithduration: (nstimeinterval) Duration delay: (nstimeinterval) Delay options: (uiviewanimationoptions) Options Animations: (void(^) (void)) Animations Completion: (void(^) (BOOL finished)) completion; + (void) Animatewithduration: (nstimeinterval) Duration animations: (void(^) (void)) Animations Completion: (void(^) (BOOL finished)) completion; + (void) Animatewithduration: (nstimeinterval) Duration animations: (void(^) (void)) animations;+ (void) Animatewithduration: (nstimeinterval) Duration delay: (nstimeinterval) Delay usingspringwithdamping: (cgfloat) Dampingratio initialspringvelocity: (cgfloat) Velocity options: (uiviewanimationoptions) Options animations: (void(^) (void)) Animations Completion: (void(^) (BOOL finished)) completion;

Properties that can be used as animation are: Frame,bounds,center,alpha, transform (settransform), Bkgcolor

If the options have the repeat option, how do you stop the animation?

Available [Self.layer removeallanimations]; stop animation

More control, setting camediatiming properties (refer to http://www.cnblogs.com/gaoxiao228/archive/2013/01/28/2880285.html)

2. If the hierachy of the view changes, use the following methods:

+ (void) Transitionwithview: (UIView *) View Duration: (nstimeinterval) Duration options: ( uiviewanimationoptions) Options animations: (void (^) (void)) Animations completion: (void ( ^) (BOOL finished)) completion; + (void) Transitionfromview: (UIView *) Fromview Toview: (UIView *) Toview Duration: (nstimeinterval) duration Options: (uiviewanimationoptions) Options completion: (void (^//  Toview added to Fromview.superview, Fromview removed from its superview

iOS Development Summary (A0)-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.