iOS development--animated programming Swift & (ii) UIView transition animation

Source: Internet
Author: User

UIView transition Animations

1     //MARK:-uiview Animation-over animation2var redview:uiview?3var blueview:uiview?4     5 //enum Uiviewanimationtransition:int {6 //        7 //Case None8 //Case Flipfromleft9 //Case FlipfromrightTen //Case Curlup One //Case Curldown A //    } -      -     //Page up the @IBAction func excessiveanimationred () -     { - uiview.beginanimations (Nil, Context:nil) -Uiview.setanimationduration (1.0)//Set Animation time +Uiview.setanimationtransition (Uiviewanimationtransition.curlup, ForView:self.view, cache:true) -Self.view.exchangeSubviewAtIndex (1, Withsubviewatindex:0) + uiview.commitanimations () A     } at      -     //PAGE DOWN - @IBAction func excessiveanimationblue () -     { - uiview.beginanimations (Nil, Context:nil) -Uiview.setanimationduration (1.0)//Set Animation time inUiview.setanimationtransition (Uiviewanimationtransition.curldown, ForView:self.view, cache:true) -Self.view.exchangeSubviewAtIndex (0, Withsubviewatindex:1) to uiview.commitanimations () +     } -      the      *     //MARK:-uiview Animation-Flip $ @IBAction func flipanimation ()Panax Notoginseng     { - uiview.beginanimations (Nil, Context:nil) theUiview.setanimationduration (1.0)//Set Animation time +Uiview.setanimationtransition (Uiviewanimationtransition.flipfromleft, Forview:testimageview, cache:true) A //uiview.setanimationtransition (Uiviewanimationtransition.flipfromright, Forview:testimageview, cache:true)  the uiview.commitanimations () +}

Create two views
1         //over-animation add two views2Redview = UIView (Frame:cgrectmake ( $, -, -, -))3Redview?. BackgroundColor =Uicolor.redcolor ()4Self.view.insertSubview (redview!, Atindex:0)5         6Blueview = UIView (Frame:cgrectmake ( $, -, -, -))7Blueview?. BackgroundColor =Uicolor.bluecolor ()8Self.view.insertSubview (blueview!, Atindex:1)

iOS development--animated programming Swift & (ii) UIView transition 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.