故事板中的自定义segue Unwind Segue导致'应用程序尝试以模态方式呈现一个活动控制器"错误迅速4?

时间:2018-02-05 06:37:43

标签: ios swift xcode user-interface uistoryboard

嘿伙计我需要一个解决方案,我的自定义segue在展开后会导致崩溃,我将如何解决?

我的自定义Segue(使用perform segue调用时工作正常):

import UIKit
class SegueFromLeft: UIStoryboardSegue {
override func perform() {
    let src = self.source
    let dst = self.destination

    src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
    dst.view.transform = CGAffineTransform(translationX: -src.view.frame.size.width, y: 0)

    UIView.animate(withDuration: 0.25,
                   delay: 0.0,
                   options: .curveEaseInOut,
                   animations: {
                    dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
    },
                   completion: { finished in
                    src.present(dst, animated: false, completion: nil)
    }
    )
}

}

Screen shot of storyboard

错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <Free.PhotoViewController: 0x7fa4ff97eaa0>.'

0 个答案:

没有答案