我试图根据UIPanGestureRecognizer的速度移动一个UIView,为此我编写了这段代码,我在这一行得到了错误
var duration:NSTimeInterval = yPoints / velocity
这是代码的一部分
let velocity = pan.velocityInView(self.superview).y
var yPoints: CGFloat = 100.0
var duration: NSTimeInterval = yPoints / velocity
var offScreenCenter: CGFloat = self.superview!.frame.origin.y
offScreenCenter += yPoints
UIView.animateWithDuration(duration, animations: {() -> Void in
self.superview!.frame.origin.y = offScreenCenter
})
我可以将此转换为Double吗?或者需要更改代码?