Segue Right,Segue Left throws:应用程序试图在Swift中以模态方式呈现一个活动控制器。为什么?

时间:2018-05-02 03:32:39

标签: ios swift

我正试图在我的VenueListVCVenueDetailsVC之间左右移动。但是当我使用带有指定类的'Application tried to present modally an active controller <VenueDetailsVC: 0x104098980>.' segue回到原始VC时,我收到以下错误: SegueFromLeft

我有以下课程; SegueFromRight从右侧转换目标VC并为其设置动画,并在其正下方SegueFromLeft类,旨在实现类似的功能,而不是通过添加&#39; - &#39;来自左侧的translationX: -src.view.frame.size.width类。减去class SegueFromRight: 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) } ) }

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)
    }
    )
}

}

prepareForUnwind

}

我的VenueListVC(来源VC)中有以下@IBAction func prepareForUnwind (segue: UIStoryboardSegue){ } IBAction

VenueDetailsVC

我使用prepareForUnwind(目标VC)中的退出点链接到VenueListVC(来源VC)的SegueFromLeft IBaction。

我已将{{1}}类添加到segue。

producer configuration setting

Segue right完美无缺,当我向后推进时,它会抛出上面的错误,但不会在呈现源VC之前抛出错误。

0 个答案:

没有答案