我使用Swift 2和Xcode 7.1
我想知道如何执行嵌套动画? 其实我想要的是,它会逐渐改变我视线的颜色。视图将:红色 - >蓝色 - >绿色 - >红色 - > ...
这是我的代码:
func animate(){
UIView.animateWithDuration(1.0, animations: {
//self.lbl.transform = CGAffineTransformMakeRotation(0.5)
self.circle.backgroundColor = UIColor(red: 0.93, green: 0.89, blue: 0.27, alpha: 1)
}, completion: {
(value: Bool) in
UIView.animateWithDuration(1.0, animations: {
//self.lbl.transform = CGAffineTransformMakeRotation(0.5)
self.circle.backgroundColor = UIColor(red: 0.3, green: 0.2, blue: 0.7, alpha: 1)
}, completion: {
(value: Bool) in
self.animate()
})
})
}
答案 0 :(得分:1)
对于动画的嵌套,您应该使用UIView.animateWithDuration
Repeat
Autoreverse
的选项,在这种情况下 UIView.animateWithDuration(2.0, delay:0, options: [.Repeat, .Autoreverse], animations: {
//execute animation changes hear
}, completion: nil)
SqlConnection conn = new SqlConnection(
"Data Source=(local);Initial Catalog=MyDBname;Integrated Security=SSPI;"
);