2015-08-25 96 views
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基于动画。代码请。

回答