的UIView.animateWithDuration呼叫我的視圖控制器的viewDidLoad功能不動畫。完成塊被立即調用。 println輸出顯示'完成true'。 viewDidLoad函數放錯了我的啓動動畫嗎?任何提示都非常感謝。UIView.animateWithDuration不是動畫
class ViewController: UIViewController {
@IBOutlet var beatIndicator:UIView?
override func viewDidLoad() {
super.viewDidLoad()
if let led = beatIndicator? {
led.alpha = 1.0
led.frame = CGRectMake(20, 20, 30, 30)
led.layer.cornerRadius = 15
UIView.animateWithDuration(3.0, animations:{
led.alpha = 0.5
led.frame = CGRectMake(25, 25, 20, 20)
led.layer.cornerRadius = 10
}, completion:{(value: Bool) in
println("completion \(value)")
})
}
// ...
}
}
剛剛拉開自己在辦公室 – 2016-02-18 18:29:55