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