Reputation: 29
I try to make fade out animation and the code like below. But I got the error like title, I don't know how to fix it. Anyone who can help me ?Thx advance!!!
private func showAnimation(){
if self.resultPresent.alpha == 1.0{
UIView.animate(withDuration: 2,option: .curveEaseOut, animations: {
self.resultPresent.alpha = CGFloat(0)→Expression type '@lvalue CGFloat' is ambiguous without more context
})
}
}
Upvotes: 0
Views: 106
Reputation: 1112
Please, use following code.The parameters to the functions you are using seems to have changed
private func showAnimation()
{
if self.resultPresent.alpha == 1.0
{
UIView.animate(withDuration: 2.0, delay: 0.0, options: .curveEaseOut, animations: {
self.resultPresent.alpha = 1.0 // Final value of alpha
}, completion: nil)
}
}
Upvotes: 1
Reputation: 17864
There is no version of UIView.animate
with the parameters you're using.
Try this instead:
UIView.animate(withDuration: 2, delay: 0, options: .curveEaseInOut, animations: {
self.resultPresent.alpha = 0
})
or, this shorter form that uses .curveEaseInOut
by default:
UIView.animate(withDuration: 2, animations: {
self.resultPresent.alpha = 0
})
Upvotes: 1