import
UIKit
class
ViewController
:
UIViewController
{
override
func
viewDidLoad()
{
super
.viewDidLoad()
let
button:
UIButton
=
(type:.
System
)
button.frame=
CGRectMake
(10,100,30)
button.setTitle(
"播放动画"
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,forState:
UIControlState
.
normal
)
button.addTarget(
self
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,action:
Selector
(
"play"
),forControlEvents:.
TouchUpInside
)
.view.addSubview(button);
redView:
UIView
(frame:
(50,150,400))
redView.backgroundColor =
UIColor
.redColor()
.view.insertSubview(redView,atIndex: 0)
blueView:
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,400))
blueView.backgroundColor =
.blueColor()
.view.insertSubview(blueView,atIndex: 1)
}
//切换视图并播放动画
play(){
.beginAnimations(
nil
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,context:
)
.setAnimationDuration(3.0)
.setAnimationTransition(.
CurlUp
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,forView:
.view,cache:
true
)
.view.exchangeSubviewAtIndex(1,withSubviewAtIndex: 0)
.commitAnimations()
}
didReceiveMemoryWarning() {
.didReceiveMemoryWarning()
}
}