我的项目中有一个自定义UIStoryBoardSegue
,我想从按钮进行转换。必须是这样的:
这是我的代码:
import UIKit
class VEShowDialogSegue: UIStoryboardSegue {
override func perform() {
var _sourceViewController : ContactsViewController = self.sourceViewController as! ContactsViewController
var _destinationViewController : DialogViewController = self.destinationViewController as! DialogViewController
var startingPoint = _sourceViewController.dialogButton.center
_sourceViewController.view.addSubview(_destinationViewController.view)
var transform = CGAffineTransformMakeScale(0.05, 0.05)
_destinationViewController.view.transform = transform
transform = CGAffineTransformMakeScale(0.05, 0.05)
transform = CGAffineTransformTranslate(transform, startingPoint.x, startingPoint.y)
UIView.animateWithDuration(0.3, animations: {
_destinationViewController.view.transform = transform
}, completion: {
(value: Bool) in
_destinationViewController.view.removeFromSuperview()
_sourceViewController.presentViewController(_destinationViewController, animated: false, completion: nil)
})
}
}
但它的工作非常糟糕。如何实现相同的过渡效果?
另外,我必须说,sourceViewController
是UIViewController
,嵌入在导航控制器中,destinationViewController
也是UIViewController
,嵌入在导航控制器中,但另一个
谢谢!