本文介绍了UIView transitionWithView swift语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人可以帮助我使用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 中会是这样的:

UIView.transitionWithView(self.view, duration: 0.325, options: UIViewAnimationOptions.CurveEaseInOut, animations: {

    // animation

    }, completion: { (finished: Bool) -> () in

    // completion

    })

这篇关于UIView transitionWithView swift语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:24