1

我不想为此使用 NavigationController。

我在两个 ViewController 之间有一个带有自定义类 UIStoryboardSegue 的 Segue(Show(Push))。现在我想“弹出”当前的 ViewController,经过一些阅读我认为这被称为“unwind segue”。

  1. 我有一个在运行时添加了代码的 UIButton。如何将展开转场添加到此按钮?

  2. 我如何使用我的自定义类来展开 segue 动画?:

    override func perform()
    {
       let src = self.sourceViewController
        let dst = self.destinationViewController
    
        src.view.superview?.insertSubview(dst.view, belowSubview: src.view)
        dst.view.transform = CGAffineTransformMakeTranslation(0, 0)
    
        UIView.animateWithDuration(0.25,
            delay: 0.0,
            options: UIViewAnimationOptions.CurveEaseInOut,
            animations: {
                src.view.transform = CGAffineTransformMakeTranslation(src.view.frame.size.width * -1, 0)
            },
            completion: { finished in
                src.presentViewController(dst, animated: false, completion: nil)
        }
    )
    }
    
4

0 回答 0