本文介绍了UIView transitionWithView swift 语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以帮助我快速了解 transitionWithView 的语法吗?在objective-c中,我会像这样使用它:
Can some help me with the syntax of the transitionWithView in swift. in objective-c I would use it like so:
[UIView transitionWithView:[ self view ] duration:0.325 options:UIViewAnimationOptionCurveEaseOut animations:
^{
// do the transition
}
completion:
^( BOOL finished ){
// cleanup after the transition
}];
但是我无法让完成处理程序工作.谢谢
However I can not get the completion handler to work.thanks
推荐答案
在 Swift 5.x 中应该是这样的:
it would be like this in Swift 5.x:
UIView.transition(with: self.view, duration: 0.325, options: .curveEaseInOut, animations: {
// animation
}) { finished in
// completion
}
这篇关于UIView transitionWithView swift 语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!