Swift 2:表达式在没有更多上下文的情况下是模糊的

时间:2015-08-03 07:20:58

标签: ios swift swift2

class Example: NSObject, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {

var aView : UIView!

UIView.animateWithDuration(duration, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: nil, animations: {

       self.aView.transform = CGAffineTransformIdentity //This line is throwing the error mentioned in the Title


            }, completion: { finished in
                transitionContext.completeTransition(true)
      })


}

这是在Swift的早期版本中工作但在版本2中失败并不确定原因

1 个答案:

答案 0 :(得分:5)

你只需要改变

UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: nil,
  animations: {

with:

UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: [],
  animations: {

只有“选项”可以改变。