Xcode 6.1:UIView.animateWithDuration额外参数'usingSpringWithDamping'

Gal*_*axy 5 xcode ios swift

我不知道为什么错误,"额外的参数'在调用中使用SpringWithDamping'突然出现在下面.

我刚刚开始,所以任何帮助将不胜感激!

    UIView.animateWithDuration(1.0,
        delay: 0,
        usingSpringWithDamping: 1.5,
        initialSpringVelocity: 5.0,
        options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
        animations: {
            self.view.backgroundColor = newColor
            self.funFactLabel.transform = CGAffineTransformMakeScale(1.25, 1.25)
        }, completion: { finished in
            UIView.animateWithDuration(2.0,
                delay: 0,
                usingSpringWithDamping: 0.5,
                initialSpringVelocity: 5.0,                    
                options: nil,
                animations: {
                    self.funFactLabel.transform = CGAffineTransformMakeScale(1.0, 1.0)
                }
            )}, completion: nil
    )
Run Code Online (Sandbox Code Playgroud)

sco*_*phc 6

试试这个:

UIView.animateWithDuration(1.0,
    delay: 0,
    usingSpringWithDamping: 1.5,
    initialSpringVelocity: 5.0,
    options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
    animations: {
        self.view.backgroundColor = newColor
        self.funFactLabel.transform = CGAffineTransformMakeScale(1.25, 1.25)
    }, completion: { finished in
        UIView.animateWithDuration(2.0,
            delay: 0,
            usingSpringWithDamping: 0.5,
            initialSpringVelocity: 5.0,
            options: nil,
            animations: {
                self.funFactLabel.transform = CGAffineTransformMakeScale(1.0, 1.0)
            } , completion: nil)
    })
Run Code Online (Sandbox Code Playgroud)

  • 我不明白.有人可以指出问题中的代码与答案中的代码之间的区别吗? (5认同)