0
我想將此View
基於動畫轉換爲基於Layer
的基礎。iOS8:查看圖層動畫
@IBOutlet weak var constraintTopContainerHeight: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
var value:CGFloat
switch (someTag)
{
case 1:
value = CGFloat(self.view.bounds.height/3)
case 2:
value = CGFloat(self.view.bounds.height/2)
case 3:
value = CGFloat(self.view.bounds.height * 0.8)
default:
value = 0.0
}
UIView.animateWithDuration(1.5, delay: 0.0,
usingSpringWithDamping: 0.3, initialSpringVelocity: 0.0,
options: nil, animations: {
self.constraintTopContainerHeight.constant = value
self.view.layoutIfNeeded()
}, completion: nil)
}
}
我如何獲得一個Constraint
使用Layer
基於動畫而不是當前View
基於動畫。代碼請。