按钮查看转换segue

时间:2015-06-30 18:31:29

标签: ios iphone swift uiviewcontroller uistoryboardsegue

我的项目中有一个自定义UIStoryBoardSegue,我想从按钮进行转换。必须是这样的: enter image description here

这是我的代码:

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)

        })
    }
}

但它的工作非常糟糕。如何实现相同的过渡效果?

另外,我必须说,sourceViewControllerUIViewController,嵌入在导航控制器中,destinationViewController也是UIViewController,嵌入在导航控制器中,但另一个

谢谢!

0 个答案:

没有答案