Swift UIView comes with some simple animations.
If this is not a complex requirement, consider using the method here.
Let's try it a little bit.
First create three views to set the three-in-one background color
Let View1=uiview (Frame:cgrectmake (Ten, A, $)) Let View2=uiview (Frame:cgrectmake () View3=uiview (Frame:cgrectmake, Max, max)) View1.backgroundcolor=uicolor.redcolor () View2.backgroundcolor=uicolor.greencolor () View3.backgroundcolor=uicolor.bluecolor ( ) Self.view.addSubview (View1) Self.view.addSubview (view2) Self.view.addSubview (VIEW3)
Down we add an animation to View1, let him delay 1 seconds to execute, and eventually enlarge his size to 300.300, the position is unchanged. Colors fade into Blue
Uiview.animatewithduration (2, delay:1, Options:UIViewAnimationOptions.CurveEaseInOut, animations: {() Void in View1.frame=cgrectmake (ten, +) View1.backgroundcolor=uicolor.bluecolor () }) {( Finished), Void in }
You can see the effect when you run it.
We see a closure on the top finished not used
We can try to use
Uiview.animatewithduration (2, delay:1, Options:UIViewAnimationOptions.CurveEaseInOut, animations: {(), Void in View1.frame=cgrectmake (ten, +, +) VIEW1.BACKGROUNDCOLOR=UICOLOR.BL Uecolor ()}) {(finished), Void in Uiview.animatewithduration (2, Delay:1, Options:UIViewAnimationOptions.CurveEaseInOut, animations: {(), Void in view1.fr Ame=cgrectmake (Ten, A, View1.backgroundcolor=uicolor.redcolor) () }) {(finished), Void in Uiview.animatewithduration (2, Delay:1, Options:UIViewAnimationOptions.CurveEaseInOut, animations: {(), Void in View1.frame=cgrectmake (Ten, View1.backgroundcolor=uicolor.bluecolor) () }) {(finished), Void in} } }
OK, run to see the effect.
Simple effect to say, you can continue to try new features, there are problems can be added group discussion
Apple Development Group: 414319235 Welcome to join the Welcome discussion question
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Swift UIView Brief animation