Whats the Swift animate WithDuration syntax?

前端 未结 4 842
夕颜
夕颜 2020-12-01 10:29

I\'m porting an older app over to Xcode 7 beta and I\'m getting an error on my animations:

Cannot invoke \'animateWithDuration\' with an argument list

4条回答
  •  感动是毒
    2020-12-01 11:07

    Swift 2

    UIView.animateWithDuration(1.0, delay: 0.1, options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
        // animation
    }, completion: { finished in
        // completion
    })
    

    Swift 3, 4, 5

    UIView.animate(withDuration: 1.0, delay: 0.1, options: [.repeat, .curveEaseOut, .autoreverse], animations: {
        // animation
    }, completion: { finished in
        // completion
    })
    

提交回复
热议问题